Skip to content

Commit 83cc5a7

Browse files
committed
test(daemon-client): pin that the lagging-clock test reaches the probe
1 parent d89173f commit 83cc5a7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/daemon-client/__tests__/daemon-client-transport.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,16 @@ test('a delayed restart health probe stops at the RPC deadline without retrying'
224224

225225
test('a restart health probe cut short by the RPC deadline reports the deadline on a lagging clock', async (t) => {
226226
if (await skipWhenLoopbackUnavailable(t)) return;
227+
let rpcCount = 0;
228+
let healthProbes = 0;
227229
const server = http.createServer((req, res) => {
228230
if (req.url === '/health') {
231+
healthProbes += 1;
229232
const delayedResponse = setTimeout(() => res.end('{}'), 1000);
230233
res.on('close', () => clearTimeout(delayedResponse));
231234
return;
232235
}
236+
rpcCount += 1;
233237
res.statusCode = 409;
234238
res.setHeader(DAEMON_HTTP_INSTANCE_MISMATCH_HEADER, 'true');
235239
res.end();
@@ -244,6 +248,8 @@ test('a restart health probe cut short by the RPC deadline reports the deadline
244248
(error: unknown) =>
245249
error instanceof AppError && error.details?.reason === 'daemon_transport_timeout',
246250
);
251+
assert.equal(rpcCount, 1);
252+
assert.equal(healthProbes, 1);
247253
} finally {
248254
now.mockRestore();
249255
await closeLoopbackServer(server);

0 commit comments

Comments
 (0)