forked from mtusi2026/mtusi2026lab6
test(observability): await measured recovery and verify store persistence
This commit is contained in:
+34
-2
@@ -74,11 +74,15 @@ def main():
|
||||
with socket.socket() as reservation:
|
||||
reservation.bind(("127.0.0.1", 0))
|
||||
public_port = str(reservation.getsockname()[1])
|
||||
with socket.socket() as grafana_reservation:
|
||||
grafana_reservation.bind(("127.0.0.1", 0))
|
||||
grafana_port = str(grafana_reservation.getsockname()[1])
|
||||
env = {
|
||||
**os.environ,
|
||||
"COMPOSE_PROJECT_NAME": project,
|
||||
"API_IMAGE": "mtusi-messenger:lab6-clean-" + identity,
|
||||
"PUBLIC_PORT": public_port,
|
||||
"GRAFANA_PORT": grafana_port,
|
||||
"VCS_REF": sha,
|
||||
"COMPOSE_FILE": "compose.yaml:compose.test.yaml",
|
||||
"NO_PROXY": "localhost,127.0.0.1",
|
||||
@@ -132,6 +136,33 @@ def main():
|
||||
receipt["http_tests"] = run(
|
||||
[".venv/bin/pytest", "student-tests", "-q"], cwd=clone, env=env
|
||||
)
|
||||
for module, extra in [
|
||||
("verify_telemetry", []),
|
||||
(
|
||||
"verify_observability_persistence",
|
||||
["--causal-evidence", "evidence/clean-telemetry.json"],
|
||||
),
|
||||
]:
|
||||
name = (
|
||||
"telemetry"
|
||||
if module == "verify_telemetry"
|
||||
else "observability-persistence"
|
||||
)
|
||||
run(
|
||||
[
|
||||
".venv/bin/python",
|
||||
"-m",
|
||||
"scripts." + module,
|
||||
"--output",
|
||||
"evidence/clean-" + name + ".json",
|
||||
*extra,
|
||||
],
|
||||
cwd=clone,
|
||||
env=env,
|
||||
)
|
||||
receipt[name] = json.loads(
|
||||
(clone / ("evidence/clean-" + name + ".json")).read_text()
|
||||
)
|
||||
run(
|
||||
[
|
||||
".venv/bin/python",
|
||||
@@ -204,11 +235,12 @@ def main():
|
||||
"relay",
|
||||
"reconciler",
|
||||
"controller",
|
||||
"observer",
|
||||
],
|
||||
cwd=clone,
|
||||
env=env,
|
||||
).split()
|
||||
assert len(ids) == 6
|
||||
assert len(ids) == 7
|
||||
for cid in ids:
|
||||
actual = json.loads(
|
||||
run(
|
||||
@@ -229,7 +261,7 @@ def main():
|
||||
)
|
||||
assert not info["HostConfig"]["PortBindings"]
|
||||
receipt[
|
||||
"api_worker_relay_reconciler_runtime_hashes_and_revision_match"
|
||||
"all_seven_application_roles_runtime_hashes_and_revision_match"
|
||||
] = True
|
||||
receipt["fsck"] = run(
|
||||
["git", "fsck", "--full"], cwd=clone, env=env
|
||||
|
||||
Reference in New Issue
Block a user