add level 5

This commit is contained in:
Матвей
2026-10-22 11:55:41 +03:00
parent 9017861707
commit 483d7eecb3
9 changed files with 133 additions and 17 deletions
+7 -2
View File
@@ -82,6 +82,9 @@ def main():
check(orphan in report["fresh_unreferenced"] and not report["deleted"], "grace period ignored")
report = reconcile("--apply", "--grace-seconds", "0")
check(report["deleted"] == [orphan], "aged orphan was not deleted safely")
report = reconcile("--apply", "--grace-seconds", "0")
check(orphan not in report["deleted"] and orphan not in report["orphan_candidates"],
"second repair run was not idempotent")
check(client.call("GET", "/api/v1/attachments/" + protected["id"] + "/content", actor=bob)["bytes"] == image,
"reconciler deleted a referenced object")
@@ -96,7 +99,9 @@ def main():
s3_code("put", missing_key, image)
check(client.call("GET", "/api/v1/attachments/" + missing["id"] + "/content", actor=bob)["bytes"] == image,
"test object was not restored")
print("PASS: dry-run, grace period, orphan deletion and missing-object reporting", flush=True)
report = reconcile("--grace-seconds", "0")
check(expected not in report["missing_objects"], "restored object remained missing on second scan")
print("PASS: S3-side missing object, dry-run, grace period and idempotent orphan repair", flush=True)
# Inject a process-equivalent failure after PUT directly into the configured
# replica. The public load balancer may correctly select the healthy peer,
@@ -127,7 +132,7 @@ else:
check(injected, "injected post-PUT failure did not create a detectable orphan")
report = reconcile("--apply", "--grace-seconds", "0")
check(set(injected).issubset(report["deleted"]), "reconciler did not clean injected orphan")
print("PASS: post-PUT/pre-DB injected failure leaves no permanent orphan", flush=True)
print("PASS: PostgreSQL-side post-PUT/pre-DB failure is repaired without deleting references", flush=True)
finally:
environment["UPLOAD_FAULT_AFTER_S3_PUT"] = "0"
subprocess.run(["docker", "compose", "up", "-d", "--force-recreate", "--no-deps", "api-a"],