-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsmoke.sh
More file actions
executable file
·71 lines (57 loc) · 1.71 KB
/
smoke.sh
File metadata and controls
executable file
·71 lines (57 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Smoke test: verify basic functionality
set -e
cd "$(dirname "$0")/.."
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}$(pwd)"
echo "Kernels Smoke Test"
echo "=================="
echo ""
echo "[1/7] Checking Python version..."
python3 --version
echo ""
echo "[2/7] Running minimal example..."
python3 examples/01_minimal_request.py
echo ""
echo "[3/7] Running tool execution example..."
python3 examples/02_tool_execution.py
echo ""
echo "[4/7] Checking CLI help..."
python3 -m kernels --help
echo ""
echo "[5/7] Checking CLI version..."
python3 -m kernels --version
echo ""
echo "[6/7] Exercising thread-safe nonce registry..."
python3 - <<'PY'
from implementations.permits_threadsafe import ThreadSafeNonceRegistry
registry = ThreadSafeNonceRegistry(ttl_ms=100)
assert registry.check_and_record("n", "iss", "sub", "permit", 2, 1000)
assert registry.check_and_record("n", "iss", "sub", "permit", 2, 1001)
assert not registry.check_and_record("n", "iss", "sub", "permit", 2, 1002)
assert registry.cleanup(1205) == 1
print("Nonce registry stats:", registry.stats())
PY
echo ""
echo "[7/7] Exercising SQLite audit storage..."
python3 - <<'PY'
from implementations.storage import SQLiteAuditStorage
entry = {
"ledger_seq": 1,
"entry_hash": "h1",
"prev_hash": "genesis",
"ts_ms": 1,
"request_id": "req-1",
"actor": "smoke",
"intent": "verify",
"decision": "allow",
"state_from": "requested",
"state_to": "approved",
}
storage = SQLiteAuditStorage(".tmp/smoke/audit.db")
storage.append("kernel-smoke", entry)
print("Storage health:", storage.health())
assert storage.list_entries("kernel-smoke")[0]["request_id"] == "req-1"
PY
echo ""
echo "=================="
echo "Smoke test passed."