Skip to content

Commit dbf7f60

Browse files
committed
test: make gateway retry deadline assertion scheduler-safe
1 parent dc09a39 commit dbf7f60

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎test/helpers/openclaw-test-instance.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,15 @@ describe("openclaw test instance", () => {
178178
expect(instance.logs().split(RESTART_MARKER)).toHaveLength(2);
179179
});
180180

181-
it("bounds both attempts by one startup deadline", async () => {
181+
it("bounds migration retries by one startup deadline", async () => {
182182
const { instance, readAttempts } = await createFakeGateway("refuse:200,hang", 500);
183183
const startedAt = Date.now();
184184
await expect(instance.startGateway()).rejects.toThrow("timeout waiting for gateway readiness");
185-
expect(await readAttempts()).toHaveLength(2);
185+
const attempts = await readAttempts();
186+
// A loaded runner may consume the deadline before observing the first refusal.
187+
// The restart-path tests above require two attempts when that refusal arrives in time.
188+
expect(attempts.length).toBeGreaterThanOrEqual(1);
189+
expect(attempts.length).toBeLessThanOrEqual(2);
186190
expect(Date.now() - startedAt).toBeLessThan(650);
187191
});
188192

0 commit comments

Comments
 (0)