Add enterprise appliance experience Phase 1 foundation

This commit is contained in:
Jino Jose committed 2026-07-12 12:13:23 +05:30
1 parent b3eec34158
commit ebaa2e7219
69 files changed
+6832 -18

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import sqlite3
from ._source import load_symbols
def test_operation_states_include_recovery_and_terminal_states():
ns = load_symbols("OPERATION_STATES", "TERMINAL_OPERATION_STATES")
assert {"requested", "running", "awaiting_reboot", "recovery_required"} <= ns["OPERATION_STATES"]
assert ns["TERMINAL_OPERATION_STATES"] <= ns["OPERATION_STATES"]
def test_operation_schema_prevents_duplicate_kind_and_idempotency_key():
ns = load_symbols("SCHEMA_VERSION", "_column_names", "run_migrations")
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE audit_log (id INTEGER PRIMARY KEY, detail TEXT)")
ns["run_migrations"](db)
values = ("1", "c1", "install", "requested", "now", "now", "same")
sql = "INSERT INTO operations (id,correlation_id,kind,state,requested_at,updated_at,idempotency_key) VALUES (?,?,?,?,?,?,?)"
db.execute(sql, values)
try:
db.execute(sql, ("2", "c2", "install", "requested", "now", "now", "same"))
except sqlite3.IntegrityError:
pass
else:
raise AssertionError("duplicate idempotent operation accepted")