diff --git a/nix/vm-tests/swarm-archive.nix b/nix/vm-tests/swarm-archive.nix index a0372069c..066593fb9 100644 --- a/nix/vm-tests/swarm-archive.nix +++ b/nix/vm-tests/swarm-archive.nix @@ -376,7 +376,15 @@ pkgs.testers.runNixOSTest { with subtest("s3: without the key in the store the server does not start"): s3archive.wait_until_succeeds("journalctl -u swarm-archive | grep -q 'No value found'") - s3archive.fail("systemctl is-active --quiet swarm-archive") + # With no key the unit crash-loops (Restart=on-failure), and systemd + # reports a Type=simple unit as active for the moment between a start + # and the wrapper's exit. A one-shot `is-active` check can land in that + # window, so ask instead whether the last run died on the missing key: + # one `systemctl show` read, exit-code result and the wrapper's status 2. + s3archive.wait_until_succeeds( + "o=$(systemctl show -p Result,ExecMainStatus swarm-archive); " + "echo \"$o\" | grep -qx 'Result=exit-code' && echo \"$o\" | grep -qx 'ExecMainStatus=2'" + ) s3archive.fail(f"curl -sf --max-time 2 -o /dev/null {url}/") with subtest("s3: the server starts once the store holds the key"):