From b16ac6e7bbc789cb0519c82e508189272099cdec Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 24 Oct 2023 14:24:10 +0200 Subject: [PATCH] nixos/tests/openssh: use dashes for hostnames Otherwise the tests will fail with `networking.useNetworkd = true;` because `systemd-resolved` ignores invalid hostnames in `/etc/hosts` (which is where all hosts from the `nodes`-attribute set end up) and subsequently e.g. `ssh server_lazy` will fail because the name cannot be resolved. In d6e84a4574a200de63e8fe86ef8574b507fd366e the test-framework was changed to replace all dashes with underscores of hostnames in the python code to have readable hostnames that are valid. I.e. nodes.foo-bar = {} represents a host with a valid hostname and it can be referenced in the `testScript` with `foo_bar`. Applying this here fixes the test for both scripted networking and networkd. --- nixos/tests/openssh.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nixos/tests/openssh.nix b/nixos/tests/openssh.nix index e88625678fec..88d3e54ee76c 100644 --- a/nixos/tests/openssh.nix +++ b/nixos/tests/openssh.nix @@ -22,7 +22,7 @@ in { ]; }; - server_lazy = + server-lazy = { ... }: { @@ -34,7 +34,7 @@ in { ]; }; - server_localhost_only = + server-localhost-only = { ... }: { @@ -43,7 +43,7 @@ in { }; }; - server_localhost_only_lazy = + server-localhost-only-lazy = { ... }: { @@ -52,7 +52,7 @@ in { }; }; - server_match_rule = + server-match-rule = { ... }: { @@ -119,11 +119,11 @@ in { ) client.succeed( - "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server_lazy 'echo hello world' >&2", + "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server-lazy 'echo hello world' >&2", timeout=30 ) client.succeed( - "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server_lazy 'ulimit -l' | grep 1024", + "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server-lazy 'ulimit -l' | grep 1024", timeout=30 ) @@ -137,7 +137,7 @@ in { timeout=30 ) client.succeed( - "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i privkey.snakeoil server_lazy true", + "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i privkey.snakeoil server-lazy true", timeout=30 )