This commit is contained in:
15
tests/smoke.sh
Executable file
15
tests/smoke.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user