mirror of
https://github.com/screentinker/screentinker.git
synced 2026-08-13 22:03:13 -06:00
test(#146) P3.9: de-flake storm harness — keep max-gap invariant, drop tick-count
The storm harness asserted a tick COUNT (environment-timing-sensitive) that could flake in CI. Kept the real invariant (max event-loop gap < 300ms) and loosened the tick assertion to >=2 (enough to have measured a real gap), which cannot flake. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bfa99771ca
commit
4547a677ab
|
|
@ -63,10 +63,12 @@ test('storm: bloated-table sweep + flapper + OTA flood — loop stays responsive
|
|||
const [deleted] = await Promise.all([prunePromise, stormPromise]);
|
||||
clearInterval(ticker);
|
||||
|
||||
// 1) NO multi-second freeze — the old whole-table sort would freeze the ticker for
|
||||
// tens of seconds here.
|
||||
// 1) THE REAL INVARIANT — NO multi-second freeze. The old whole-table sort would
|
||||
// freeze the ticker for tens of seconds here.
|
||||
assert.ok(maxGap < 300, `loop never froze — max event-loop gap ${maxGap}ms (was 40-48s pre-fix)`);
|
||||
assert.ok(ticks >= 10, `ticker kept firing through the storm (${ticks} ticks)`);
|
||||
// #146 P3.9: the exact tick count is environment-timing-sensitive; assert only that
|
||||
// the ticker sampled enough to have MEASURED a real gap (>=2), not a brittle count.
|
||||
assert.ok(ticks >= 2, `ticker sampled the run (${ticks} ticks) — max-gap measurement is meaningful`);
|
||||
// 2) The sweep actually drained the backlog to the cap.
|
||||
assert.ok(deleted >= 298000, `sweep trimmed the backlog (${deleted} deleted)`);
|
||||
assert.equal(db.prepare('SELECT COUNT(*) c FROM device_status_log').get().c, 1500, '3 devices x 500 cap');
|
||||
|
|
|
|||
Loading…
Reference in a new issue