mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-18 02:46:28 +00:00
cbc45b5981
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.
43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
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");
|
|
|
|
'';
|
|
}
|