test(redis-worker): allow timer jitter in mollifier drainer stop-timeout test
Node's setTimeout can fire a millisecond or two early under CI load, causing the existing `>= 500ms` lower bound to flake (saw 499ms in CI). Loosen to `>= 450ms` — the behaviour being pinned is "stop honors the deadline instead of waiting for the hung handler indefinitely", not millisecond-precise timing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1243,7 +1243,11 @@ describe("MollifierDrainer.start/stop", () => {
|
||||
await drainer.stop({ timeoutMs: 500 });
|
||||
const stopElapsed = Date.now() - stopStart;
|
||||
|
||||
expect(stopElapsed).toBeGreaterThanOrEqual(500);
|
||||
// Allow a small jitter window below `timeoutMs` — Node's setTimeout can
|
||||
// fire a millisecond or two early under CI load. The behaviour we're
|
||||
// pinning is "stop honors the deadline instead of waiting for the hung
|
||||
// handler indefinitely", not millisecond-precise timing.
|
||||
expect(stopElapsed).toBeGreaterThanOrEqual(450);
|
||||
expect(stopElapsed).toBeLessThan(2_000);
|
||||
} finally {
|
||||
await buffer.close();
|
||||
|
||||
Reference in New Issue
Block a user