nixos: Make 'nesting.clone' work in NixOS tests (#62069)
nixos: Make 'nesting.clone' work in NixOS tests
This commit is contained in:
commit
b09c6ac05b
@ -32,14 +32,14 @@ rec {
|
|||||||
|
|
||||||
import ./eval-config.nix {
|
import ./eval-config.nix {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = configurations ++
|
modules = configurations ++ extraConfigurations;
|
||||||
|
baseModules = (import ../modules/module-list.nix) ++
|
||||||
[ ../modules/virtualisation/qemu-vm.nix
|
[ ../modules/virtualisation/qemu-vm.nix
|
||||||
../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
|
../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
|
||||||
{ key = "no-manual"; documentation.nixos.enable = false; }
|
{ key = "no-manual"; documentation.nixos.enable = false; }
|
||||||
{ key = "qemu"; system.build.qemu = qemu; }
|
{ key = "qemu"; system.build.qemu = qemu; }
|
||||||
] ++ optional minimal ../modules/testing/minimal-kernel.nix
|
{ key = "nodes"; _module.args.nodes = nodes; }
|
||||||
++ extraConfigurations;
|
] ++ optional minimal ../modules/testing/minimal-kernel.nix;
|
||||||
extraArgs = { inherit nodes; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ in
|
|||||||
nat.standalone = handleTest ./nat.nix { withFirewall = false; };
|
nat.standalone = handleTest ./nat.nix { withFirewall = false; };
|
||||||
ndppd = handleTest ./ndppd.nix {};
|
ndppd = handleTest ./ndppd.nix {};
|
||||||
neo4j = handleTest ./neo4j.nix {};
|
neo4j = handleTest ./neo4j.nix {};
|
||||||
|
nesting = handleTest ./nesting.nix {};
|
||||||
netdata = handleTest ./netdata.nix {};
|
netdata = handleTest ./netdata.nix {};
|
||||||
networking.networkd = handleTest ./networking.nix { networkd = true; };
|
networking.networkd = handleTest ./networking.nix { networkd = true; };
|
||||||
networking.scripted = handleTest ./networking.nix { networkd = false; };
|
networking.scripted = handleTest ./networking.nix { networkd = false; };
|
||||||
|
42
nixos/tests/nesting.nix
Normal file
42
nixos/tests/nesting.nix
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import ./make-test.nix {
|
||||||
|
name = "nesting";
|
||||||
|
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 = ''
|
||||||
|
$clone->waitForUnit("default.target");
|
||||||
|
$clone->succeed("cowsay hey");
|
||||||
|
$clone->fail("hello");
|
||||||
|
|
||||||
|
# Nested clones do inherit from parent
|
||||||
|
$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");
|
||||||
|
|
||||||
|
'';
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user