diff options
author | aszlig <aszlig@redmoonstudios.org> | 2015-03-17 23:44:29 +0100 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2015-03-17 23:44:29 +0100 |
commit | 2ecebd2481790a912db98b00432514ad3f3ea083 (patch) | |
tree | a42862a07093dd62324ee533183439bf86ca3ac2 /tests | |
parent | e5e5cfbf33008ca3260cd4f2dd78986694dfb027 (diff) |
tests: Add make-test.nix with labernix packages.
We're going not only to modify all VM test nodes, but also inject the updated pkgs into the tests own arguments, so we can refer to them even outside of testing machine configuration modules. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'tests')
-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 |