From b4ce4e0d90e95fc4840275284807f8e84b30f979 Mon Sep 17 00:00:00 2001 From: atlas Date: Wed, 28 Oct 2026 20:27:18 +0100 Subject: [PATCH 1/3] put hello and tree in the agent-ephemeral-rootfs vm closure --- nix/vm-tests/agent-ephemeral-rootfs.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix/vm-tests/agent-ephemeral-rootfs.nix b/nix/vm-tests/agent-ephemeral-rootfs.nix index c07451ad4..44fcccf14 100644 --- a/nix/vm-tests/agent-ephemeral-rootfs.nix +++ b/nix/vm-tests/agent-ephemeral-rootfs.nix @@ -72,6 +72,12 @@ pkgs.testers.runNixOSTest { ../host-modules/hive-priv.nix ]; virtualisation.memorySize = 2048; + # The script `nix-env -i`s these store paths inside the container, which + # shares the host's store; the VM has no substituter to fetch them. + virtualisation.additionalPaths = [ + pkgs.hello + pkgs.tree + ]; # The agent bridge hive-priv names in the container's conf. networking.bridges.${bridge}.interfaces = [ ]; networking.interfaces.${bridge}.ipv4.addresses = [ From 2b4fd52b0a80e22eafc93213abe4cc89a1a49153 Mon Sep 17 00:00:00 2001 From: atlas Date: Wed, 28 Oct 2026 21:02:33 +0100 Subject: [PATCH 2/3] make the vm test's priv request wait for the salvage reply --- nix/vm-tests/agent-ephemeral-rootfs.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nix/vm-tests/agent-ephemeral-rootfs.nix b/nix/vm-tests/agent-ephemeral-rootfs.nix index 44fcccf14..b7ec00c73 100644 --- a/nix/vm-tests/agent-ephemeral-rootfs.nix +++ b/nix/vm-tests/agent-ephemeral-rootfs.nix @@ -140,8 +140,14 @@ pkgs.testers.runNixOSTest { "binds": BINDS, "isolation": {"bridge": "${bridge}", "gateway_ip": "${gateway}"}, }) - out = host.succeed(f"echo '{req}' | socat - UNIX-CONNECT:/run/hive/priv.sock") - assert json.loads(out.strip().splitlines()[-1])["ok"] is True, out + # socat gives up 0.5s after its stdin ends unless told to wait; the + # salvage copies a whole root, which takes longer. + out = host.succeed(f"echo '{req}' | socat -t 120 - UNIX-CONNECT:/run/hive/priv.sock") + print("hive-priv answered: " + repr(out)) + print(host.execute("journalctl -u hive-priv --no-pager | tail -n 30")[1]) + lines = out.strip().splitlines() + assert lines, "hive-priv sent no response" + assert json.loads(lines[-1])["ok"] is True, out def conf(): return host.succeed(f"cat /etc/nixos-containers/{MACHINE}.conf") From bbc2a83771c07536f3ad643d10a601afb1942b51 Mon Sep 17 00:00:00 2001 From: atlas Date: Wed, 28 Oct 2026 21:51:15 +0100 Subject: [PATCH 3/3] print the vm test's priv response and journal only on failure --- nix/vm-tests/agent-ephemeral-rootfs.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nix/vm-tests/agent-ephemeral-rootfs.nix b/nix/vm-tests/agent-ephemeral-rootfs.nix index b7ec00c73..3088a7065 100644 --- a/nix/vm-tests/agent-ephemeral-rootfs.nix +++ b/nix/vm-tests/agent-ephemeral-rootfs.nix @@ -132,6 +132,9 @@ pkgs.testers.runNixOSTest { def stop(): host.succeed(f"nixos-container stop {MACHINE}") + def priv_journal(): + return host.execute("journalctl -u hive-priv --no-pager | tail -n 30")[1] + def write_flags(): """What hive-c0re does before every start: one request to hive-priv.""" req = json.dumps({ @@ -143,11 +146,10 @@ pkgs.testers.runNixOSTest { # socat gives up 0.5s after its stdin ends unless told to wait; the # salvage copies a whole root, which takes longer. out = host.succeed(f"echo '{req}' | socat -t 120 - UNIX-CONNECT:/run/hive/priv.sock") - print("hive-priv answered: " + repr(out)) - print(host.execute("journalctl -u hive-priv --no-pager | tail -n 30")[1]) lines = out.strip().splitlines() - assert lines, "hive-priv sent no response" - assert json.loads(lines[-1])["ok"] is True, out + # The journal is read only when the assert fires. + assert lines, f"hive-priv sent no response; journal:\n{priv_journal()}" + assert json.loads(lines[-1])["ok"] is True, f"response={out!r}; journal:\n{priv_journal()}" def conf(): return host.succeed(f"cat /etc/nixos-containers/{MACHINE}.conf")