mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
feat(submodules): test for custom default condition
This commit is contained in:
parent
bae2b8d3e6
commit
33a344119b
1 changed files with 21 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ let
|
||||||
instance2 = config.submodules.instances.instance2;
|
instance2 = config.submodules.instances.instance2;
|
||||||
instance3 = config.submodules.instances.instance3;
|
instance3 = config.submodules.instances.instance3;
|
||||||
instance4 = config.submodules.instances.instance4;
|
instance4 = config.submodules.instances.instance4;
|
||||||
|
instance5 = config.submodules.instances.instance5;
|
||||||
|
|
||||||
module = {name, ...}: {
|
module = {name, ...}: {
|
||||||
options.args.value = mkOption {
|
options.args.value = mkOption {
|
||||||
|
|
@ -28,16 +29,16 @@ in {
|
||||||
name = "submodules-defatuls";
|
name = "submodules-defatuls";
|
||||||
description = "Simple k8s submodule test";
|
description = "Simple k8s submodule test";
|
||||||
assertions = [{
|
assertions = [{
|
||||||
message = "instance1 should have value of value1";
|
message = "should apply defaults by tag1";
|
||||||
assertion = instance1.config.args.value == "value1";
|
assertion = instance1.config.args.value == "value1";
|
||||||
} {
|
} {
|
||||||
message = "instance2 should have value of value2";
|
message = "should apply defaults by tag2";
|
||||||
assertion = instance2.config.args.value == "value2";
|
assertion = instance2.config.args.value == "value2";
|
||||||
} {
|
} {
|
||||||
message = "instance2 should have value of value2";
|
message = "should apply defaults by tag2";
|
||||||
assertion = instance3.config.args.value == "value2";
|
assertion = instance3.config.args.value == "value2";
|
||||||
} {
|
} {
|
||||||
message = "instance1 and instance2 should have value of value";
|
message = "should apply defaults to all";
|
||||||
assertion =
|
assertion =
|
||||||
instance1.config.args.defaultValue == "value" &&
|
instance1.config.args.defaultValue == "value" &&
|
||||||
instance2.config.args.defaultValue == "value";
|
instance2.config.args.defaultValue == "value";
|
||||||
|
|
@ -45,8 +46,11 @@ in {
|
||||||
message = "instance1 and instance3 should have value of default-value";
|
message = "instance1 and instance3 should have value of default-value";
|
||||||
assertion = instance3.config.args.defaultValue == "default-value";
|
assertion = instance3.config.args.defaultValue == "default-value";
|
||||||
} {
|
} {
|
||||||
message = "instance4 should have value of value4";
|
message = "should apply defaults by submodule name";
|
||||||
assertion = instance4.config.args.value == "value4";
|
assertion = instance4.config.args.value == "value4";
|
||||||
|
} {
|
||||||
|
message = "should apply defaults by custom condition";
|
||||||
|
assertion = instance5.config.args.defaultValue == "my-custom-value";
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -77,6 +81,13 @@ in {
|
||||||
name = "submodule4";
|
name = "submodule4";
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
} {
|
||||||
|
modules = [module {
|
||||||
|
submodule = {
|
||||||
|
name = "submodule5";
|
||||||
|
};
|
||||||
|
args.value = "custom-value";
|
||||||
|
}];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
submodules.defaults = [{
|
submodules.defaults = [{
|
||||||
|
|
@ -90,6 +101,10 @@ in {
|
||||||
} {
|
} {
|
||||||
name = "submodule4";
|
name = "submodule4";
|
||||||
default.args.value = mkDefault "value4";
|
default.args.value = mkDefault "value4";
|
||||||
|
} {
|
||||||
|
default = {config, ...}: {
|
||||||
|
args.defaultValue = mkIf (config.args.value == "custom-value") "my-custom-value";
|
||||||
|
};
|
||||||
}];
|
}];
|
||||||
|
|
||||||
submodules.instances.instance1.submodule = "submodule1";
|
submodules.instances.instance1.submodule = "submodule1";
|
||||||
|
|
@ -99,4 +114,5 @@ in {
|
||||||
config.args.defaultValue = "default-value";
|
config.args.defaultValue = "default-value";
|
||||||
};
|
};
|
||||||
submodules.instances.instance4.submodule = "submodule4";
|
submodules.instances.instance4.submodule = "submodule4";
|
||||||
|
submodules.instances.instance5.submodule = "submodule5";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue