depot/nixos/tests/nixos-test-driver/node-name.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

33 lines
852 B
Nix

{
name = "nixos-test-driver.node-name";
nodes = {
"ok" = { };
# Valid node name, but not a great host name.
"one_two" = { };
# Valid node name, good host name
"a-b" = { };
# TODO: would be nice to test these eval failures
# Not allowed by lib/testing/network.nix (yet?)
# "foo.bar" = { };
# Not allowed.
# "not ok" = { }; # not ok
};
testScript = ''
start_all()
with subtest("python vars exist and machines are reachable through test backdoor"):
ok.succeed("true")
one_two.succeed("true")
a_b.succeed("true")
with subtest("hostname is derived from the node name"):
ok.succeed("hostname | tee /dev/stderr | grep '^ok$'")
one_two.succeed("hostname | tee /dev/stderr | grep '^onetwo$'")
a_b.succeed("hostname | tee /dev/stderr | grep '^a-b$'")
'';
}