summaryrefslogtreecommitdiff
path: root/test/web
diff options
context:
space:
mode:
Diffstat (limited to 'test/web')
-rw-r--r--test/web/catalog_ui.mjs9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/web/catalog_ui.mjs b/test/web/catalog_ui.mjs
index bed40b2..d030842 100644
--- a/test/web/catalog_ui.mjs
+++ b/test/web/catalog_ui.mjs
@@ -119,6 +119,15 @@ try {
assert.equal(await evaluate(`document.documentElement.scrollWidth <= innerWidth`), true, 'mobile page does not overflow');
await fs.writeFile('.zig-cache/catalog-ui/mobile.png', Buffer.from((await cdp('Page.captureScreenshot', { format: 'png' })).data, 'base64'));
assert.deepEqual(exceptions, []);
+ // A live port remains exclusive, but TIME_WAIT must not break a restart.
+ const competitor = start(binary, ['--listen', `127.0.0.1:${dashboard}`]);
+ await wait(() => competitor.exitCode !== null, 'competing listener refused');
+ assert.notEqual(competitor.exitCode, 0);
+ assert.match(competitor.output, /address already in use/);
+ web.kill('SIGTERM'); await once(web, 'exit');
+ await fs.unlink(path.join(work, 'catalog.sock'));
+ start(binary, ['--listen', `127.0.0.1:${dashboard}`, '--catalog', path.join(work, 'config.json'), '--catalog-socket', path.join(work, 'catalog.sock'), '--state-dir', path.join(work, 'state')]);
+ await wait(async () => (await fetch(url)).ok && (await fetch(`http://127.0.0.1:${sitePort}`)).ok, 'immediate restart with recent HTTP traffic');
console.log('catalog_ui: shared shell/style, tab history, file/log navigation, build control, focus, dirty edits and mobile layout passed');
} catch (e) {
for (const child of children) console.error(child.output.slice(-5000));