diff --git a/test/integration/mesh.test.ts b/test/integration/mesh.test.ts index c6dccbf..351f88f 100644 --- a/test/integration/mesh.test.ts +++ b/test/integration/mesh.test.ts @@ -338,7 +338,14 @@ test("both machines join it, and the token is all they need", { skip, timeout: 9 await mesh("assign anchor networking"); await must("anchor", `pgrep -x mesh-host >/dev/null || (nohup ${HOST_PATH} run > /var/log/mesh-host.log 2>&1 & sleep 3)`); await mesh("push anchor"); - await new Promise((r) => setTimeout(r, 8000)); + // The host reports which of its links face outside with every apply, and the filter is not + // composed for a machine that has not — so its first apply is waited for, not slept past. + const appliedBy = Date.now() + 180_000; + while (!(await on("anchor", `grep -q 'applied [0-9]' /var/log/mesh-host.log`)).ok) { + if (Date.now() > appliedBy) assert.fail(`the anchor never applied what it was sent:\n${(await on("anchor", "tail -30 /var/log/mesh-host.log")).out}`); + await new Promise((r) => setTimeout(r, 3000)); + } + await new Promise((r) => setTimeout(r, 5000)); await deriveTheFilterOn({ machine: "anchor", node: "anchor", hubPort: 51820, must, mesh, on }); // **The laptop makes its tunnel key, and the token is issued for it.** The hub is told the key