perf(test): tighten channel health monitor timer windows

This commit is contained in:
Peter Steinberger
2026-02-18 22:36:44 +00:00
parent 65002b2b4b
commit 8a6b55e715

View File

@@ -91,7 +91,7 @@ describe("channel-health-monitor", () => {
it("does not run before the grace period", async () => {
const manager = createMockChannelManager();
const monitor = startDefaultMonitor(manager, { startupGraceMs: 60_000 });
await vi.advanceTimersByTimeAsync(10_000);
await vi.advanceTimersByTimeAsync(5_001);
expect(manager.getRuntimeSnapshot).not.toHaveBeenCalled();
monitor.stop();
});
@@ -244,9 +244,9 @@ describe("channel-health-monitor", () => {
cooldownCycles: 1,
maxRestartsPerHour: 3,
});
await vi.advanceTimersByTimeAsync(5_500);
await vi.advanceTimersByTimeAsync(5_001);
expect(manager.startChannel).toHaveBeenCalledTimes(3);
await vi.advanceTimersByTimeAsync(2_000);
await vi.advanceTimersByTimeAsync(1_001);
expect(manager.startChannel).toHaveBeenCalledTimes(3);
monitor.stop();
});
@@ -282,7 +282,7 @@ describe("channel-health-monitor", () => {
const manager = createMockChannelManager();
const monitor = startDefaultMonitor(manager);
monitor.stop();
await vi.advanceTimersByTimeAsync(10_000);
await vi.advanceTimersByTimeAsync(5_001);
expect(manager.getRuntimeSnapshot).not.toHaveBeenCalled();
});
@@ -291,7 +291,7 @@ describe("channel-health-monitor", () => {
const abort = new AbortController();
const monitor = startDefaultMonitor(manager, { abortSignal: abort.signal });
abort.abort();
await vi.advanceTimersByTimeAsync(10_000);
await vi.advanceTimersByTimeAsync(5_001);
expect(manager.getRuntimeSnapshot).not.toHaveBeenCalled();
monitor.stop();
});