diff options
author | Arian van Putten <aeroboy94@gmail.com> | 2019-05-26 00:52:52 +0200 |
---|---|---|
committer | Arian van Putten <aeroboy94@gmail.com> | 2019-05-29 12:50:49 +0200 |
commit | cbc45b5981f26c80e7d78e9525373b1388b7e516 (patch) | |
tree | 1a6afa5224b652882b22ef23c7c81c992dab0364 /nixos/tests/nesting.nix | |
parent | a48047a755047b34471a740dffa07744221d63c2 (diff) | |
download | nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.tar nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.tar.gz nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.tar.bz2 nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.tar.lz nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.tar.xz nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.tar.zst nixlib-cbc45b5981f26c80e7d78e9525373b1388b7e516.zip |
nixos: Make nesting.children work in NixOS tests
We differentiate between modules and baseModules in the VM builder for NixOS tests. This way, nesting.children, eventhough it doesn't inherit from parent, still has enough config to actually complete the test. Otherwise, the qemu modules would not be loaded, for example, and a nesting.children statement would not evaluate.
Diffstat (limited to 'nixos/tests/nesting.nix')
-rw-r--r-- | nixos/tests/nesting.nix | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/nixos/tests/nesting.nix b/nixos/tests/nesting.nix index 3be64d7a9b54..1306d6f8e0c5 100644 --- a/nixos/tests/nesting.nix +++ b/nixos/tests/nesting.nix @@ -1,22 +1,42 @@ import ./make-test.nix { name = "nesting"; - machine = { pkgs, ... }: { - environment.systemPackages = [ pkgs.cowsay ]; - nesting.clone = [ - ({ pkgs, ... }: { - environment.systemPackages = [ pkgs.hello ]; - }) - ]; + nodes = { + clone = { pkgs, ... }: { + environment.systemPackages = [ pkgs.cowsay ]; + nesting.clone = [ + ({ pkgs, ... }: { + environment.systemPackages = [ pkgs.hello ]; + }) + ]; + }; + children = { pkgs, ... }: { + environment.systemPackages = [ pkgs.cowsay ]; + nesting.children = [ + ({ pkgs, ... }: { + environment.systemPackages = [ pkgs.hello ]; + }) + ]; + }; }; testScript = '' - $machine->waitForUnit("default.target"); - $machine->succeed("cowsay hey"); - $machine->fail("hello"); + $clone->waitForUnit("default.target"); + $clone->succeed("cowsay hey"); + $clone->fail("hello"); # Nested clones do inherit from parent - $machine->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test"); - $machine->succeed("cowsay hey"); - $machine->succeed("hello"); + $clone->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test"); + $clone->succeed("cowsay hey"); + $clone->succeed("hello"); + + + $children->waitForUnit("default.target"); + $children->succeed("cowsay hey"); + $children->fail("hello"); + + # Nested children do not inherit from parent + $children->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test"); + $children->fail("cowsay hey"); + $children->succeed("hello"); ''; } |