Files
USB-AIO/tests/smoke.sh
Denis Stoecklmeier 81f06cf6b4
Some checks failed
Tests / test (push) Has been cancelled
USB-AIO für automatische Geräteprüfung
2026-10-14 20:14:36 +02:00

16 lines
759 B
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "$0")/.."
for sh in scripts/*.sh; do bash -n "$sh"; done
python -m py_compile scripts/*.py
python - <<'PY'
import json, pathlib, sqlite3, subprocess, tempfile
with tempfile.TemporaryDirectory() as td:
p=pathlib.Path(td); report=p/'report.json'; db=p/'database'/'intake.sqlite3'
report.write_text(json.dumps({'asset_id':'PC-0001','tool_version':'1.1.1','model':'Test PC','cpu':'CPU','health_gate':'REVIEW','timestamp_unix':123}))
subprocess.run(['python','scripts/db-import.py',str(db),str(report)],check=True)
subprocess.run(['python','scripts/db-view.py',str(db)],check=True)
with sqlite3.connect(db) as c: assert c.execute('SELECT count(*) FROM scans').fetchone()[0]==1
print('smoke checks OK')
PY