fix(mesh): name the teapot in the boot log a later 404 points back to
A route the absent teapot would have exported 404s, and that is the right status: nothing was ever registered for a manifest that never arrived, so there is no path to serve. But a bare 404 is indistinguishable from a typo in the path, and the boot log is the only place the two are told apart. It could not tell them apart either. The give-up warning relied on the error's own message to identify the teapot, which holds for a refusal -- `mesh handshake failed: <url>` -- but not for an unreachable one, where the error is a socket error that may carry no url at all. So the url is passed in now, and every line of the boot-connect story names it: the retries, the refusal, and the give-up. The give-up line also says no manifest was ever exchanged, which is the fact that explains the 404. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+44
-7
No files matched your search
@@ -191,6 +191,41 @@ describe('mesh boot retry', () => {
|
||||
}
|
||||
}, 15_000);
|
||||
|
||||
it('names the teapot in the log a later 404 points back to', async () => {
|
||||
// A route the absent teapot would have exported 404s, because nothing was ever registered for a
|
||||
// manifest that never arrived. That is the right status — you cannot serve what was never
|
||||
// declared — but a bare 404 is indistinguishable from a typo in the path. The boot log is the
|
||||
// only place the two are told apart, so it has to name *which* teapot and say that no manifest
|
||||
// was exchanged. The unreachable error itself is a socket error and does not reliably carry
|
||||
// the url, so the url is passed in rather than scraped out of the message.
|
||||
const { lines, logger } = collect();
|
||||
const teacup = createApp({
|
||||
modules: [LocalOnlyModule],
|
||||
experimental: true,
|
||||
logger,
|
||||
mesh: {
|
||||
teapots: [{ url: 'ws://127.0.0.1:9/x', secret: 's' }],
|
||||
secret: 's',
|
||||
bootTimeoutMs: 300,
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
await teacup.ready();
|
||||
const gaveUp = lines.find((line) => line.includes('starting without it'));
|
||||
|
||||
expect(gaveUp).toBeDefined();
|
||||
expect(gaveUp).toContain('ws://127.0.0.1:9/x');
|
||||
expect(gaveUp).toMatch(/no manifest was ever exchanged/i);
|
||||
expect(gaveUp).toMatch(/404/);
|
||||
|
||||
// and the retry lines on the way there name it too, so a deploy tailing logs sees which one
|
||||
expect(lines.some((line) => /retrying/.test(line) && line.includes('ws://127.0.0.1:9/x'))).toBe(true);
|
||||
} finally {
|
||||
await teacup.close();
|
||||
}
|
||||
}, 15_000);
|
||||
|
||||
it('still fails the boot when a local step needs a token the absent teapot owned', async () => {
|
||||
const teacup = createApp({
|
||||
modules: [NeedsAuthModule], // a step with needs: ['auth']
|
||||
|
||||
Reference in new issue
Block a user