Skip to content

Commit 7294ec6

Browse files
committed
Add SSH port-forwarded test driver wrapper via QEMU_NET_OPTS
Uses SLiRP hostfwd to forward host:2222 -> VM:22, allowing SSH into test VMs from upterm without TAP/bridge setup. No per-VM config changes needed, preserves VDE inter-VM networking for future multi-VM tests.
1 parent c3cb263 commit 7294ec6

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/test-nixos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
6868
- name: Start nixos test (background)
6969
run: |
70-
nix run --file . nixosTests.containerd.driverInteractive --option sandbox false -- --no-interactive > /tmp/test.log 2>&1 &
70+
nix run --file . nixosTestsSSH.containerd.driverInteractive --option sandbox false -- --no-interactive > /tmp/test.log 2>&1 &
7171
echo $! > /tmp/test.pid
7272
echo "Test running in background (PID: $(cat /tmp/test.pid))"
7373
sleep 5

default.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ rec {
172172
};
173173
};
174174

175+
# Wrapped test drivers with SSH port forwarding via QEMU_NET_OPTS
176+
# Forwards host:2222 → VM:22 through SLiRP so you can SSH into the VM
177+
nixosTestsSSH = lib.mapAttrs (
178+
_: test:
179+
let
180+
wrappedDriver = pkgs.writeShellScriptBin "nixos-test-driver" ''
181+
export QEMU_NET_OPTS="hostfwd=tcp::2222-:22"
182+
exec ${test.driverInteractive}/bin/nixos-test-driver "$@"
183+
'';
184+
in
185+
test // { driverInteractive = wrappedDriver; }
186+
) nixosTests;
187+
175188
lixImage = pkgs.callPackage ./liximage.nix { };
176189
scratchImage = pkgs.callPackage ./scratchimage.nix { };
177190
}

0 commit comments

Comments
 (0)