forked from mtusi2026/mtusi2026lab7
test(pki): measure bounded backlog drain after controlled outages
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -312,7 +312,16 @@ def main():
|
|||||||
assert messages <= found
|
assert messages <= found
|
||||||
accepted = [row for row in load.uploads if row[2] == 202]
|
accepted = [row for row in load.uploads if row[2] == 202]
|
||||||
pending = {row[3] for row in accepted}
|
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()
|
failed = set()
|
||||||
while pending and time.monotonic() < deadline:
|
while pending and time.monotonic() < deadline:
|
||||||
for identity in list(pending):
|
for identity in list(pending):
|
||||||
@@ -349,6 +358,10 @@ def main():
|
|||||||
)
|
)
|
||||||
failed.clear()
|
failed.clear()
|
||||||
time.sleep(1)
|
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"
|
assert not pending, "Accepted upload not ready after recovery"
|
||||||
for row in accepted[:: max(1, len(accepted) // 5)]:
|
for row in accepted[:: max(1, len(accepted) // 5)]:
|
||||||
r = client.get(
|
r = client.get(
|
||||||
|
|||||||
Reference in New Issue
Block a user