fix(checks/inventory): use buildClan instead of buildInventory

This commit is contained in:
Johannes Kirschbauer
2025-04-09 17:30:23 +02:00
parent 9f159084cd
commit c67481c474
5 changed files with 37 additions and 3 deletions

View File

@@ -1,6 +1,10 @@
(import ../lib/test-inventory.nix) (
{ ... }:
{
# This tests the compatibility of the inventory
# With the test framework
# - legacy-modules
# - clan.service modules
name = "dummy-inventory-test";
inventory.directory = ./.;
@@ -8,22 +12,52 @@
machines.peer1 = { };
machines.admin1 = { };
services = {
dummy-module.default = {
legacy-module.default = {
roles.peer.machines = [ "peer1" ];
roles.admin.machines = [ "admin1" ];
};
};
instances."test" = {
module.name = "new-service";
roles.peer.machines.peer1 = { };
};
modules = {
dummy-module = ./dummy-module;
legacy-module = ./legacy-module;
new-service = {
_class = "clan.service";
manifest.name = "new-service";
roles.peer = {};
perMachine = {
nixosModule = {
# This should be generated by:
# ./pkgs/scripts/update-vars.py inventory-test-framework-compatibility-test
clan.core.vars.generators.new-service = {
files.hello = {
secret = false;
deploy = true;
};
script = ''
# This is a dummy script that does nothing
echo "This is a dummy script" > $out/hello
'';
};
};
};
};
};
};
testScript = ''
testScript = { nodes, ...}: ''
start_all()
admin1.wait_for_unit("multi-user.target")
peer1.wait_for_unit("multi-user.target")
# Provided by the legacy module
print(admin1.succeed("systemctl status dummy-service"))
print(peer1.succeed("systemctl status dummy-service"))
# peer1 should have the 'hello' file
peer1.succeed("cat ${nodes.peer1.clan.core.vars.generators.new-service.files.hello.path}")
'';
}
)