tests: Refactor

This commit is contained in:
SebastianStork 2026-03-10 19:06:29 +01:00
parent 33b2bed5a9
commit 8cf724fb97
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
3 changed files with 29 additions and 65 deletions

View file

@ -5,22 +5,28 @@
let
mkTest = dir: rec {
name = "${dir}-test";
value = pkgs.testers.runNixOSTest (
{
inherit name;
}
// import "${self}/tests/${dir}" {
inherit
inputs
self
pkgs
lib
;
}
);
value = pkgs.testers.runNixOSTest {
inherit name;
imports = [ "${self}/tests/${dir}" ];
node.specialArgs = { inherit inputs self; };
defaults =
{ nodes, ... }:
{
imports = [ self.nixosModules.default ];
_module.args.allHosts = nodes |> lib.mapAttrs (_: node: { config = node; });
users = {
mutableUsers = false;
users.seb = {
isNormalUser = true;
password = "seb";
};
};
custom.networking.underlay.interface = "eth1";
};
};
};
in
{
checks = "${self}/tests" |> builtins.readDir |> lib.attrNames |> lib.map mkTest |> lib.listToAttrs;
checks = "${self}/tests" |> self.lib.listDirectoryNames |> lib.map mkTest |> lib.listToAttrs;
};
}