diff --git a/nixos/lib/testing/run.nix b/nixos/lib/testing/run.nix index 752c1e9118035..45ab311cfbc4a 100644 --- a/nixos/lib/testing/run.nix +++ b/nixos/lib/testing/run.nix @@ -106,6 +106,11 @@ in # useful for inspection (debugging / exploration) passthru.config = config; + /** + For discoverTests only. Deprecated. Will be removed when discoverTests can be removed from NixOS all-tests.nix. + */ + passthru.test = config.test; + # Docs: nixos/doc/manual/development/writing-nixos-tests.section.md /** See https://nixos.org/manual/nixos/unstable#sec-override-nixos-test diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index d370a41802868..4fd1c64693ac6 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -18,10 +18,12 @@ with pkgs.lib; let + # TODO: remove when handleTest is gone (make sure nixosTests and nixos/release.nix#tests are unaffected) + # TODO: when removing, also deprecate `test` attribute in ../lib/testing/run.nix discoverTests = val: if isAttrs val then - if hasAttr "test" val then + if (val ? test) then callTest val else mapAttrs (n: s: if n == "passthru" then s else discoverTests s) val