diff options
author | Jacek Galowicz <jacek@galowicz.de> | 2023-05-12 16:04:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 16:04:26 +0200 |
commit | cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b (patch) | |
tree | 475faa40193803afd7c007da9f0e937f00149d8c /pkgs/build-support | |
parent | 1f4ba7987762d1248fa80a6be6b74ca6915bb14f (diff) | |
parent | ac1134f321b60f9e27ab0d973a4544480acc0709 (diff) |
Merge pull request #225313 from hercules-ci/testers-runNixOSTest
testers.runNixOSTest: init
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/testers/default.nix | 14 | ||||
-rw-r--r-- | pkgs/build-support/testers/test/default.nix | 11 |
2 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix index 542133dd959a3..190ce72d0e630 100644 --- a/pkgs/build-support/testers/default.nix +++ b/pkgs/build-support/testers/default.nix @@ -95,6 +95,20 @@ in checked; # See doc/builders/testers.chapter.md or + # https://nixos.org/manual/nixpkgs/unstable/#tester-runNixOSTest + runNixOSTest = + let nixos = import ../../../nixos/lib {}; + in testModule: + nixos.runTest { + _file = "pkgs.runNixOSTest implementation"; + imports = [ + (lib.setDefaultModuleLocation "the argument that was passed to pkgs.runNixOSTest" testModule) + ]; + hostPkgs = pkgs; + node.pkgs = pkgs; + }; + + # See doc/builders/testers.chapter.md or # https://nixos.org/manual/nixpkgs/unstable/#tester-invalidateFetcherByDrvHash nixosTest = let diff --git a/pkgs/build-support/testers/test/default.nix b/pkgs/build-support/testers/test/default.nix index 313c556737fb3..fc4df4964f398 100644 --- a/pkgs/build-support/testers/test/default.nix +++ b/pkgs/build-support/testers/test/default.nix @@ -14,6 +14,17 @@ in lib.recurseIntoAttrs { hasPkgConfigModule = pkgs.callPackage ../hasPkgConfigModule/tests.nix { }; + runNixOSTest-example = pkgs-with-overlay.testers.runNixOSTest ({ lib, ... }: { + name = "runNixOSTest-test"; + nodes.machine = { pkgs, ... }: { + system.nixos = dummyVersioning; + environment.systemPackages = [ pkgs.proof-of-overlay-hello pkgs.figlet ]; + }; + testScript = '' + machine.succeed("hello | figlet >/dev/console") + ''; + }); + # Check that the wiring of nixosTest is correct. # Correct operation of the NixOS test driver should be asserted elsewhere. nixosTest-example = pkgs-with-overlay.testers.nixosTest ({ lib, pkgs, figlet, ... }: { |