mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
feat(submodules): add test for submodule passthru
This commit is contained in:
parent
9ca9c44c92
commit
e9dbb01005
2 changed files with 60 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ let
|
|||
./submodules/defaults.nix
|
||||
./submodules/versioning.nix
|
||||
./submodules/exports.nix
|
||||
./submodules/passthru.nix
|
||||
];
|
||||
testing.args = {
|
||||
inherit images k8sVersion;
|
||||
|
|
|
|||
59
tests/submodules/passthru.nix
Normal file
59
tests/submodules/passthru.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{ name, config, lib, kubenix, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
submodule = { name, ... }: {
|
||||
imports = [ kubenix.modules.submodule ];
|
||||
|
||||
config.submodule = {
|
||||
name = "subm";
|
||||
passthru.global.${name} = "true";
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = with kubenix.modules; [ test submodules ];
|
||||
|
||||
options = {
|
||||
global = mkOption {
|
||||
description = "Global value";
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
test = {
|
||||
name = "submodules-passthru";
|
||||
description = "Submodules passthru test";
|
||||
assertions = [{
|
||||
message = "should passthru values if passthru enabled";
|
||||
assertion = hasAttr "inst1" config.global && config.global.inst1 == "true";
|
||||
} {
|
||||
message = "should not passthru values if passthru not enabled";
|
||||
assertion = !(hasAttr "inst2" config.global);
|
||||
} {
|
||||
message = "should passthru by default";
|
||||
assertion = hasAttr "inst3" config.global && config.global.inst3 == "true";
|
||||
}];
|
||||
};
|
||||
|
||||
submodules.imports = [{
|
||||
modules = [submodule];
|
||||
}];
|
||||
|
||||
submodules.instances.inst1 = {
|
||||
submodule = "subm";
|
||||
passthru.enable = true;
|
||||
};
|
||||
|
||||
submodules.instances.inst2 = {
|
||||
submodule = "subm";
|
||||
passthru.enable = false;
|
||||
};
|
||||
|
||||
submodules.instances.inst3 = {
|
||||
submodule = "subm";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue