mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 01:09:43 +02:00
Merge #559: range-check the remote-wake readiness budget instead of pinning it to the millisecond
This commit is contained in:
@@ -559,9 +559,14 @@ describe('RemoteWakeRegistry', () => {
|
|||||||
h.registry.ensureAwake(h.session, { force: true, timeoutMs: REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS })
|
h.registry.ensureAwake(h.session, { force: true, timeoutMs: REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS })
|
||||||
).resolves.toBe(true);
|
).resolves.toBe(true);
|
||||||
expect(h.waitUntilReady).toHaveBeenCalledWith(remote, {
|
expect(h.waitUntilReady).toHaveBeenCalledWith(remote, {
|
||||||
timeoutMs: REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS,
|
timeoutMs: expect.any(Number),
|
||||||
signal: expect.any(AbortSignal),
|
signal: expect.any(AbortSignal),
|
||||||
});
|
});
|
||||||
|
// Not asserted to the millisecond: the wake's own elapsed time is subtracted, so a
|
||||||
|
// slow runner lands a few ms under the budget.
|
||||||
|
const [, readyOpts] = h.waitUntilReady.mock.calls[0] as [unknown, { timeoutMs: number; signal: AbortSignal }];
|
||||||
|
expect(readyOpts.timeoutMs).toBeLessThanOrEqual(REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS);
|
||||||
|
expect(readyOpts.timeoutMs).toBeGreaterThan(REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS - 1_000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2238,10 +2238,15 @@ describe('session-routes', () => {
|
|||||||
// The request budget, not the 90 s session default: the reverse proxy would
|
// The request budget, not the 90 s session default: the reverse proxy would
|
||||||
// cut the request at 60 s while the session was still being built.
|
// cut the request at 60 s while the session was still being built.
|
||||||
expect(wakeWaitUntilReady).toHaveBeenCalledWith(expect.objectContaining({ hostId: 'hufflepuff' }), {
|
expect(wakeWaitUntilReady).toHaveBeenCalledWith(expect.objectContaining({ hostId: 'hufflepuff' }), {
|
||||||
timeoutMs: REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS,
|
timeoutMs: expect.any(Number),
|
||||||
// The shutdown signal rides along so `WebServer.stop()` can end the poll.
|
// The shutdown signal rides along so `WebServer.stop()` can end the poll.
|
||||||
signal: expect.any(AbortSignal),
|
signal: expect.any(AbortSignal),
|
||||||
});
|
});
|
||||||
|
// Not asserted to the millisecond: the wake's own elapsed time is subtracted,
|
||||||
|
// so a slow runner lands a few ms under the budget.
|
||||||
|
const [, readyOpts] = wakeWaitUntilReady.mock.calls[0] as unknown as [unknown, { timeoutMs: number }];
|
||||||
|
expect(readyOpts.timeoutMs).toBeLessThanOrEqual(REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS);
|
||||||
|
expect(readyOpts.timeoutMs).toBeGreaterThan(REMOTE_WAKE_REQUEST_READY_TIMEOUT_MS - 1_000);
|
||||||
} finally {
|
} finally {
|
||||||
startShell.mockRestore();
|
startShell.mockRestore();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user