# Guest-config VM test, NAT (unbridged) mode: guest/common.nix as it sits on # the host's isolated bridge, where there is no DHCP server and the guest # must be fully served by its static service-net configuration. # # The guest node and the mode-independent assertions (seeding, idempotency, # account, SSH) are shared with guest-vm-bridged via common.nix; # the networking assertions here only make sense in this mode. # # Build with (never run by an agent, only by the operator/CI): # nix build .#checks.x86_64-linux.guest-vm-unbridged --impure -L { pkgs, determinate }: let common = import ./common.nix { inherit determinate; }; in pkgs.testers.runNixOSTest { name = "hermenix-guest-config-unbridged"; # Boots once, reboots once, and runs only quick local checks — a few # minutes is generous. Bound it far below the framework's 1-hour default so # a genuine hang (boot failure, a blocked prompt, a stuck reboot) fails # fast instead of burning a full hour before being reported. globalTimeout = 600; nodes.machine = common.guestNode; testScript = common.commonScript + '' # --- NAT-mode networking ------------------------------------------- # The isolated vlan has no DHCP server, so the guest's NIC must be # self-sufficient: exactly the one static service-net address, and # exactly one default route - via the host - because the DHCP client # found nobody to talk to and contributed nothing. The interface name # is deliberately not hard-coded (the real guest's NIC name varies too; # only the address layout is asserted). addrs = machine.succeed("ip -4 -o addr show | grep -v '^1: lo'").strip().splitlines() assert len(addrs) == 1, f"expected only the static service-net address, got: {addrs}" assert "10.77.0.2/24" in addrs[0], f"static service-net address missing: {addrs}" machine.succeed("test \"$(ip -4 route show default | wc -l)\" -eq 1") machine.succeed("ip -4 route show default | grep -q 'default via 10.77.0.1'") ''; }