From d6e84a4574a200de63e8fe86ef8574b507fd366e Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 25 Apr 2023 08:48:47 +0000 Subject: nixosTest: remove hostname limitations --- nixos/doc/manual/development/writing-nixos-tests.section.md | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nixos/doc/manual/development') diff --git a/nixos/doc/manual/development/writing-nixos-tests.section.md b/nixos/doc/manual/development/writing-nixos-tests.section.md index 3de46fda3df67..486a4b64a262f 100644 --- a/nixos/doc/manual/development/writing-nixos-tests.section.md +++ b/nixos/doc/manual/development/writing-nixos-tests.section.md @@ -130,6 +130,11 @@ starting them in parallel: start_all() ``` +If the hostname of a node contains characters that can't be used in a +Python variable name, those characters will be replaced with +underscores in the variable name, so `nodes.machine-a` will be exposed +to Python as `machine_a`. + ## Machine objects {#ssec-machine-objects} The following methods are available on machine objects: -- cgit 1.4.1 From 3ec3d283c5c21567b2c1242fc6d3516d4ebb6e5b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 25 Apr 2023 11:59:14 +0200 Subject: nixos/tests: extra-python-packages -> nixos-test-driver/extra-python-packages Categorizing the tests for the test driver helps with testing the test driver. --- .../development/developing-the-test-driver.chapter.md | 2 ++ nixos/tests/all-tests.nix | 9 ++++++++- nixos/tests/extra-python-packages.nix | 13 ------------- nixos/tests/nixos-test-driver/extra-python-packages.nix | 13 +++++++++++++ 4 files changed, 23 insertions(+), 14 deletions(-) delete mode 100644 nixos/tests/extra-python-packages.nix create mode 100644 nixos/tests/nixos-test-driver/extra-python-packages.nix (limited to 'nixos/doc/manual/development') diff --git a/nixos/doc/manual/development/developing-the-test-driver.chapter.md b/nixos/doc/manual/development/developing-the-test-driver.chapter.md index 4b70fe00af476..d64574fa62aaa 100644 --- a/nixos/doc/manual/development/developing-the-test-driver.chapter.md +++ b/nixos/doc/manual/development/developing-the-test-driver.chapter.md @@ -25,6 +25,8 @@ These include `pkgs.nixosTest`, `testing-python.nix` and `make-test-python.nix`. ## Testing changes to the test framework {#sec-test-the-test-framework} +We currently have limited unit tests for the framework itself. You may run these with `nix-build -A nixosTests.nixos-test-driver`. + When making significant changes to the test framework, we run the tests on Hydra, to avoid disrupting the larger NixOS project. For this, we use the `python-test-refactoring` branch in the `NixOS/nixpkgs` repository, and its [corresponding Hydra jobset](https://hydra.nixos.org/jobset/nixos/python-test-refactoring). diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 715fe7e51e0f2..9257fc607fc98 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -66,6 +66,14 @@ let ; in { + + # Testing the test driver + nixos-test-driver = { + extra-python-packages = handleTest ./nixos-test-driver/extra-python-packages.nix {}; + }; + + # NixOS vm tests and non-vm unit tests + _3proxy = runTest ./3proxy.nix; aaaaxy = runTest ./aaaaxy.nix; acme = runTest ./acme.nix; @@ -218,7 +226,6 @@ in { etcd-cluster = handleTestOn ["x86_64-linux"] ./etcd-cluster.nix {}; etebase-server = handleTest ./etebase-server.nix {}; etesync-dav = handleTest ./etesync-dav.nix {}; - extra-python-packages = handleTest ./extra-python-packages.nix {}; evcc = handleTest ./evcc.nix {}; fancontrol = handleTest ./fancontrol.nix {}; fcitx5 = handleTest ./fcitx5 {}; diff --git a/nixos/tests/extra-python-packages.nix b/nixos/tests/extra-python-packages.nix deleted file mode 100644 index 7a48077cf98bc..0000000000000 --- a/nixos/tests/extra-python-packages.nix +++ /dev/null @@ -1,13 +0,0 @@ -import ./make-test-python.nix ({ ... }: - { - name = "extra-python-packages"; - - extraPythonPackages = p: [ p.numpy ]; - - nodes = { }; - - testScript = '' - import numpy as np - assert str(np.zeros(4) == "array([0., 0., 0., 0.])") - ''; - }) diff --git a/nixos/tests/nixos-test-driver/extra-python-packages.nix b/nixos/tests/nixos-test-driver/extra-python-packages.nix new file mode 100644 index 0000000000000..1146bedd996f8 --- /dev/null +++ b/nixos/tests/nixos-test-driver/extra-python-packages.nix @@ -0,0 +1,13 @@ +import ../make-test-python.nix ({ ... }: + { + name = "extra-python-packages"; + + extraPythonPackages = p: [ p.numpy ]; + + nodes = { }; + + testScript = '' + import numpy as np + assert str(np.zeros(4) == "array([0., 0., 0., 0.])") + ''; + }) -- cgit 1.4.1