From 98ac96ef808bf3c4b1062f87fc85befbc739dd88 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 22 Sep 2026 05:33:41 -0700 Subject: [PATCH] test(buzz): advance the room restoration deadline after admission (#154855) --- .../buzz/src/buzz-bus.room-restoration.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/extensions/buzz/src/buzz-bus.room-restoration.test.ts b/extensions/buzz/src/buzz-bus.room-restoration.test.ts index d19703c65fde..21853fd9ec69 100644 --- a/extensions/buzz/src/buzz-bus.room-restoration.test.ts +++ b/extensions/buzz/src/buzz-bus.room-restoration.test.ts @@ -15,6 +15,7 @@ beforeEach(() => { }); afterEach(() => { + vi.useRealTimers(); resetPluginStateStoreForTests(); vi.restoreAllMocks(); vi.unstubAllEnvs(); @@ -438,18 +439,29 @@ it.each(["closed", "missing EOSE"] as const)( onMessage: async () => {}, onFatalError: (error) => fatal.push(error), }); + if (failure === "missing EOSE") { + await bus.sendText({ channelId: fixture.roomId, text: "restoration startup barrier" }); + vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout"] }); + } const history = fixture.pauseNextRoomHistory(); publishBotRole(fixture, skipped.roomId, "bot", skipped.createdAt + 1); notifyBotMembership(fixture, skipped.roomId, 44100, skipped.createdAt + 1); await history.started; if (failure === "closed") { history.close("fixture room history failed"); + await vi.waitFor(() => expect(fatal).toHaveLength(1), { timeout: 11000 }); + expect(fatal[0]?.message).toContain("closed"); + } else { + expect(fatal).toEqual([]); + await vi.advanceTimersByTimeAsync(10_000); + expect(fatal).toHaveLength(1); + expect(fatal[0]?.message).toBe( + `Timed out loading Buzz room membership changes for ${skipped.roomId}`, + ); } - await vi.waitFor(() => expect(fatal).toHaveLength(1), { timeout: 11000 }); - expect(fatal[0]?.message).toContain(failure === "closed" ? "closed" : "Timed out"); await expect( bus.sendText({ channelId: fixture.roomId, text: "failed generation reply" }), - ).rejects.toThrow(); + ).rejects.toThrow(fatal[0]); } finally { await bus?.close(); await fixture.close();