Inventory/enabled: add eval test
This commit is contained in:
@@ -120,7 +120,7 @@ let
|
|||||||
globalExtraModules ++ machineExtraModules ++ roleServiceExtraModules
|
globalExtraModules ++ machineExtraModules ++ roleServiceExtraModules
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
if !serviceConfig.enabled then
|
if !(serviceConfig.enabled or true) then
|
||||||
acc2
|
acc2
|
||||||
else if isInService then
|
else if isInService then
|
||||||
acc2
|
acc2
|
||||||
|
|||||||
@@ -200,4 +200,33 @@ in
|
|||||||
msg = "no machine with tag '\\w+' found";
|
msg = "no machine with tag '\\w+' found";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
test_inventory_disabled_service =
|
||||||
|
let
|
||||||
|
configs = buildInventory {
|
||||||
|
directory = ./.;
|
||||||
|
inventory = {
|
||||||
|
services = {
|
||||||
|
borgbackup.instance_1 = {
|
||||||
|
enabled = false;
|
||||||
|
roles.client.machines = [ "machine_1" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
machines = {
|
||||||
|
"machine_1" = {
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
expr = {
|
||||||
|
machine_1_config = (builtins.head configs."machine_1");
|
||||||
|
};
|
||||||
|
expected = {
|
||||||
|
# Empty config
|
||||||
|
machine_1_config = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user