From 89b6dd6080ff7e8db6c0b3d05654461844640fad Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 31 Aug 2026 13:11:02 +0200 Subject: [PATCH] Print why the resolver did not start, instead of that it did not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `systemctl is-active` exits non-zero for a unit that failed, so `must` threw before the assertion carrying every diagnostic — and the run said only "failed". The journal, the config, what the mesh wrote and resolv.conf are all things the next run should not have to be re-run to see. --- test/integration/mesh.test.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/integration/mesh.test.ts b/test/integration/mesh.test.ts index db46fd8..fc63b71 100644 --- a/test/integration/mesh.test.ts +++ b/test/integration/mesh.test.ts @@ -1392,10 +1392,18 @@ test("a service is reached by a name under the machine it runs on", { await mesh("push"); await new Promise((r) => setTimeout(r, 25_000)); + // `on`, not `must`: `is-active` exits non-zero for a unit that failed, so `must` would throw + // before the assertion below — taking every diagnostic with it. That happened, and the run said + // only "failed". for (const machine of ["anchor", "laptop"]) { - assert.match(await must(machine, `systemctl is-active dnsmasq.service`), /^active/, - `the resolver is not running on ${machine}:\n` + - `${(await on(machine, `journalctl -u dnsmasq -n 20 --no-pager`)).out}`); + const state = await on(machine, `systemctl is-active dnsmasq.service`); + if (state.out.trim() === "active") continue; + assert.fail( + `the resolver is not running on ${machine} (${state.out.trim()}):\n\n` + + `journal:\n${(await on(machine, `journalctl -u dnsmasq -n 25 --no-pager`)).out}\n` + + `its config:\n${(await on(machine, `cat /etc/dnsmasq.conf`)).out}\n` + + `what the mesh wrote:\n${(await on(machine, `cat /etc/mesh-resolver/nodes.conf`)).out}\n` + + `resolv.conf:\n${(await on(machine, `cat /etc/resolv.conf`)).out}`); } // Through the machine's own resolver, by the path an application actually takes: nsswitch, then