mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 14:57:28 +03:00
nixosTests.nixos-test-driver.node-name: init
This commit is contained in:
parent
3ec3d283c5
commit
e207f4a116
@ -70,6 +70,7 @@ in {
|
||||
# Testing the test driver
|
||||
nixos-test-driver = {
|
||||
extra-python-packages = handleTest ./nixos-test-driver/extra-python-packages.nix {};
|
||||
node-name = runTest ./nixos-test-driver/node-name.nix;
|
||||
};
|
||||
|
||||
# NixOS vm tests and non-vm unit tests
|
||||
|
33
nixos/tests/nixos-test-driver/node-name.nix
Normal file
33
nixos/tests/nixos-test-driver/node-name.nix
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
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$'")
|
||||
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user