diff options
-rw-r--r-- | tests/heinrich.nix | 2 | ||||
-rw-r--r-- | tests/make-test.nix | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/tests/heinrich.nix b/tests/heinrich.nix index 6a424c21..c524835e 100644 --- a/tests/heinrich.nix +++ b/tests/heinrich.nix @@ -1,4 +1,4 @@ -import <nixpkgs/nixos/tests/make-test.nix> { +import ./make-test.nix { name = "heinrich"; nodes = let diff --git a/tests/make-test.nix b/tests/make-test.nix new file mode 100644 index 00000000..c20bd3ef --- /dev/null +++ b/tests/make-test.nix @@ -0,0 +1,26 @@ +f: { system ? builtins.currentSystem, ... } @ args: let + testLib = import <nixpkgs/nixos/lib/testing.nix> { + inherit system; + }; + + pkgs = import <nixpkgs> { inherit system; }; + + testArgs = if builtins.isFunction f then f (args // { + pkgs = pkgs // { + labernix = import ../pkgs { inherit pkgs; }; + }; + }) else f; + + nodes = if testArgs ? machine then { + inherit (testArgs) machine; + } else testArgs.nodes; + + injectCommon = name: values: { + imports = [ ../common.nix values ]; + }; + + testArgsWithCommon = removeAttrs testArgs [ "machine" ] // { + nodes = testLib.mapAttrs injectCommon nodes; + }; + +in testLib.makeTest testArgs |