Skip to content

Commit 7bd1580

Browse files
author
Guy Bedford
authored
test: more carefully check the timeout tests (#808)
1 parent a520361 commit 7bd1580

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

integration-tests/js-compute/fixtures/app/src/dynamic-backend.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ routes.set("/backend/timeout", async () => {
2828
let error = await assertRejects(() => fetch('https://http-me.glitch.me/test?wait=5000', {
2929
backend,
3030
cacheOverride: new CacheOverride("pass"),
31-
}));
31+
}), DOMException, 'HTTP response timeout');
3232
console.timeEnd(`fetch('https://http-me.glitch.me/test?wait=5000'`)
3333
if (error) { return error }
3434
return pass('ok')
@@ -62,14 +62,15 @@ routes.set("/backend/timeout", async () => {
6262
if (isRunningLocally()) {
6363
return pass('ok');
6464
}
65+
allowDynamicBackends(true)
6566
allowDynamicBackends({
66-
betweenBytesTimeout: 1_000,
67-
connectTimeout: 1_000,
68-
firstByteTimeout: 1_000
67+
betweenBytesTimeout: 3_000,
68+
connectTimeout: 3_000,
69+
firstByteTimeout: 3_000
6970
});
70-
console.time(`fetch('https://http-me.glitch.me/test?wait=5000'`)
71-
let error = await assertRejects(() => fetch('https://http-me.glitch.me/test?wait=5000'));
72-
console.timeEnd(`fetch('https://http-me.glitch.me/test?wait=5000'`)
71+
let error = await assertResolves(() => fetch('https://http-me.glitch.me/test?wait=2000'))
72+
if (error) { return error }
73+
error = await assertRejects(() => fetch('https://http-me.glitch.me/test?wait=5000'), DOMException, 'HTTP response timeout');
7374
if (error) { return error }
7475
return pass('ok')
7576
});

0 commit comments

Comments
 (0)