Unverified Commit b16ac6e7 authored by Maximilian Bosch's avatar Maximilian Bosch
Browse files

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 d6e84a45 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.
parent 7359dcf5
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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
        )