From e1220d1a4181722813e9f4608d8dc81f366110d6 Mon Sep 17 00:00:00 2001 From: Brandur Date: Sat, 17 Oct 2026 00:57:07 -0400 Subject: [PATCH] JavaScript: Fix flaky maintenance batcher test Fix a flaky test case that assumed a successful batch would finish within 1 ms. CI scheduling delays can easily cause the build to exceed that deadline and unexpectedly trip the circuit breaker. Uses the existing controlled clock for elapsed time checks while retaining real timeout signals for failed batches. --- js/src/internal/maintenance-batch.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/src/internal/maintenance-batch.test.ts b/js/src/internal/maintenance-batch.test.ts index d8e798221..24d695421 100644 --- a/js/src/internal/maintenance-batch.test.ts +++ b/js/src/internal/maintenance-batch.test.ts @@ -151,7 +151,9 @@ describe("MaintenanceBatcher", () => { }); it("resets the breaker when a batch succeeds", async () => { - const batcher = new MaintenanceBatcher({ random: () => 0, timeoutMs: 1 }); + // Keep elapsed time fixed so CI scheduling cannot make the successful + // batch overrun 1 ms. Failed batches still exercise real timeout signals. + const { batcher } = setup(1); const limit = batcher.breaker.limit; for (let round = 0; round < 2; round++) {