test(pki): measure bounded backlog drain after controlled outages

This commit is contained in:
2026-11-22 18:10:47 +03:00
parent 5926f6fee2
commit 6974b11a75
3 changed files with 7962 additions and 1 deletions
+14 -1
View File
@@ -312,7 +312,16 @@ def main():
assert messages <= found
accepted = [row for row in load.uploads if row[2] == 202]
pending = {row[3] for row in accepted}
deadline = time.monotonic() + 120
drain_started = time.monotonic()
# Expiry/seal can accumulate work and duplicate wakeups. Allow a
# bounded drain window for this backlog; every accepted upload must
# still reach ready, without resetting its durable state.
report["drain"] = {
"maximum_seconds": 600,
"accepted_uploads": len(accepted),
"initial_pending_to_check": len(pending),
}
deadline = drain_started + 600
failed = set()
while pending and time.monotonic() < deadline:
for identity in list(pending):
@@ -349,6 +358,10 @@ def main():
)
failed.clear()
time.sleep(1)
report["drain"].update(
elapsed_seconds=round(time.monotonic() - drain_started, 3),
remaining=len(pending),
)
assert not pending, "Accepted upload not ready after recovery"
for row in accepted[:: max(1, len(accepted) // 5)]:
r = client.get(