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 d6e84a4574 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.
This commit is contained in:
Maximilian Bosch 2023-10-24 14:24:10 +02:00
parent 7359dcf561
commit b16ac6e7bb
No known key found for this signature in database
GPG Key ID: 9A6EEA275CA5BE0A

View File

@ -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
)