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 /doc | |
parent | 1f4ba7987762d1248fa80a6be6b74ca6915bb14f (diff) | |
parent | ac1134f321b60f9e27ab0d973a4544480acc0709 (diff) | |
download | nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.tar nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.tar.gz nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.tar.bz2 nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.tar.lz nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.tar.xz nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.tar.zst nixlib-cc8e4ed375fe0a3d2f5cf8e5e05943e58e7c4f2b.zip |
Merge pull request #225313 from hercules-ci/testers-runNixOSTest
testers.runNixOSTest: init
Diffstat (limited to 'doc')
-rw-r--r-- | doc/builders/testers.chapter.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/builders/testers.chapter.md b/doc/builders/testers.chapter.md index a644262fd9c9..928a57673e77 100644 --- a/doc/builders/testers.chapter.md +++ b/doc/builders/testers.chapter.md @@ -164,6 +164,26 @@ tests.fetchgit = testers.invalidateFetcherByDrvHash fetchgit { }; ``` +## `runNixOSTest` {#tester-runNixOSTest} + +A helper function that behaves exactly like the NixOS `runTest`, except it also assigns this Nixpkgs package set as the `pkgs` of the test and makes the `nixpkgs.*` options read-only. + +If your test is part of the Nixpkgs repository, or if you need a more general entrypoint, see ["Calling a test" in the NixOS manual](https://nixos.org/manual/nixos/stable/index.html#sec-calling-nixos-tests). + +Example: + +```nix +pkgs.testers.runNixOSTest ({ lib, ... }: { + name = "hello"; + nodes.machine = { pkgs, ... }: { + environment.systemPackages = [ pkgs.hello ]; + }; + testScript = '' + machine.succeed("hello") + ''; +}) +``` + ## `nixosTest` {#tester-nixosTest} Run a NixOS VM network test using this evaluation of Nixpkgs. |