Compare commits
1 changed files with 2 additions and 16 deletions
|
|
@ -72,12 +72,6 @@ pkgs.testers.runNixOSTest {
|
||||||
../host-modules/hive-priv.nix
|
../host-modules/hive-priv.nix
|
||||||
];
|
];
|
||||||
virtualisation.memorySize = 2048;
|
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.
|
# The agent bridge hive-priv names in the container's conf.
|
||||||
networking.bridges.${bridge}.interfaces = [ ];
|
networking.bridges.${bridge}.interfaces = [ ];
|
||||||
networking.interfaces.${bridge}.ipv4.addresses = [
|
networking.interfaces.${bridge}.ipv4.addresses = [
|
||||||
|
|
@ -132,9 +126,6 @@ pkgs.testers.runNixOSTest {
|
||||||
def stop():
|
def stop():
|
||||||
host.succeed(f"nixos-container stop {MACHINE}")
|
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():
|
def write_flags():
|
||||||
"""What hive-c0re does before every start: one request to hive-priv."""
|
"""What hive-c0re does before every start: one request to hive-priv."""
|
||||||
req = json.dumps({
|
req = json.dumps({
|
||||||
|
|
@ -143,13 +134,8 @@ pkgs.testers.runNixOSTest {
|
||||||
"binds": BINDS,
|
"binds": BINDS,
|
||||||
"isolation": {"bridge": "${bridge}", "gateway_ip": "${gateway}"},
|
"isolation": {"bridge": "${bridge}", "gateway_ip": "${gateway}"},
|
||||||
})
|
})
|
||||||
# socat gives up 0.5s after its stdin ends unless told to wait; the
|
out = host.succeed(f"echo '{req}' | socat - UNIX-CONNECT:/run/hive/priv.sock")
|
||||||
# salvage copies a whole root, which takes longer.
|
assert json.loads(out.strip().splitlines()[-1])["ok"] is True, out
|
||||||
out = host.succeed(f"echo '{req}' | socat -t 120 - UNIX-CONNECT:/run/hive/priv.sock")
|
|
||||||
lines = out.strip().splitlines()
|
|
||||||
# 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():
|
def conf():
|
||||||
return host.succeed(f"cat /etc/nixos-containers/{MACHINE}.conf")
|
return host.succeed(f"cat /etc/nixos-containers/{MACHINE}.conf")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue