Skip to content

Commit

Permalink
testers.nixosTest: Deprecate
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Apr 22, 2024
1 parent d1c6f0e commit 43bb838
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/build-helpers/testers.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ pkgs.testers.runNixOSTest ({ lib, ... }: {

## `nixosTest` {#tester-nixosTest}

This function is deprecated in favor of [`runNixOSTest`](#tester-runNixOSTest). The reason why it's bad is that when you pass it a function, it is invoked via `callPackage`. This is somewhat incompatible with the module system and running cross-platform:
- The choice of packages is ambiguous when the VM host platform is not Linux. `nixosTest` could in theory pick either:
- `hostPkgs` for packages to run on the VM host
- or `config.node.pkgs` for packages that run in one of the VMs
- The return value of the passed function should have been a module, but `nixosTest` does not actually allow that.

Run a NixOS VM network test using this evaluation of Nixpkgs.

NOTE: This function is primarily for external use. NixOS itself uses `make-test-python.nix` directly. Packages defined in Nixpkgs [reuse NixOS tests via `nixosTests`, plural](#ssec-nixos-tests-linking).
Expand Down
1 change: 1 addition & 0 deletions pkgs/build-support/testers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
* make sense for this evaluation of Nixpkgs.
*/
nixosTesting =
lib.warn "testers.nixosTest is deprecated. Use testers.runNixOSTest instead."
(import ../../../nixos/lib/testing-python.nix {
inherit (stdenv.hostPlatform) system;
inherit pkgs;
Expand Down

0 comments on commit 43bb838

Please sign in to comment.