From 23d7be2248a34bed2d29d9997a812c3f08ea10ce Mon Sep 17 00:00:00 2001 From: Tom Fitzhenry Date: Wed, 7 Jan 2026 20:41:26 +1100 Subject: [PATCH] tests/openssh: move order-dependent test to top When working on nixosTests.openssh, I keep forgetting that there is order-dependence, despite me adding a comment about this in commit 41911ed so let's solve ordering once-and-for-all but making the order-dependent machine predictably-first. --- nixos/tests/openssh.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nixos/tests/openssh.nix b/nixos/tests/openssh.nix index 97ed224b5afb..fca192c15fc7 100644 --- a/nixos/tests/openssh.nix +++ b/nixos/tests/openssh.nix @@ -90,9 +90,11 @@ in ]; }; - server-lazy-socket = { + # IP addresses are allocated according to the alphabetical order of the machine name, and since tests rely on the IP address of this machine, let's name it so it's order (and thus address) is predictable. + aaa-server-lazy-socket = { virtualisation.vlans = [ 1 + # Allocate another VLAN so we can exercise listening on a non-standard address. 2 ]; services.openssh = { @@ -302,7 +304,7 @@ in server_lazy.wait_for_unit("sshd.socket", timeout=60) server_localhost_only_lazy.wait_for_unit("sshd.socket", timeout=60) - server_lazy_socket.wait_for_unit("sshd.socket", timeout=60) + aaa_server_lazy_socket.wait_for_unit("sshd.socket", timeout=60) # sshd-keygen is a oneshot unit, so just wait for multi-user.target, which # pulls it in. @@ -340,14 +342,14 @@ in timeout=30 ) - with subtest("socket activation on a non-standard port"): + with subtest("socket activation on a non-standard address and port"): client.succeed( "cat ${snakeOilPrivateKey} > privkey.snakeoil" ) client.succeed("chmod 600 privkey.snakeoil") # The final segment in this IP is allocated according to the alphabetical order of machines in this test. client.succeed( - "ssh -p 2222 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i privkey.snakeoil root@192.168.2.5 true", + "ssh -p 2222 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i privkey.snakeoil root@192.168.2.1 true", timeout=30 )