depot/third_party/nixpkgs/nixos/tests/nixos-test-driver/node-name.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03: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$'")
'';
}