From 2ecebd2481790a912db98b00432514ad3f3ea083 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 17 Mar 2015 23:44:29 +0100 Subject: 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 --- tests/heinrich.nix | 2 +- tests/make-test.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/make-test.nix (limited to 'tests') 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 { +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 { + inherit system; + }; + + pkgs = import { 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 -- cgit 1.4.1