From 021564ffd40d54a59dd461b7d0d5e00a3c86ed0e Mon Sep 17 00:00:00 2001 From: Soispha Peetz Date: Thu, 29 Oct 2026 23:32:22 +0100 Subject: treewide: Rework entry points and attribute names That just makes a lot of stuff easier and more streamlined. Also, all choices between stable or unstable nixpkgs should now be explicit. --- tests/default.nix | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'tests/default.nix') diff --git a/tests/default.nix b/tests/default.nix index 88ea7d9..870ecfb 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,7 +1,10 @@ { - specialArgs, - nixLib, - pkgs, + packageSets, + extra_modules, + module_args, + special_args, + extra_lib, + sources, }: let splitAttr = attr: let pairs = builtins.attrNames attr; @@ -50,31 +53,28 @@ ports ? [], # If `true`, will ignore this test. ignore ? null, + # Should this test use the stable nixpkgs? + stable ? true, testScript ? {_, ...}: "", }: let # Apparently the default's (e.g. `serivces ? []`), are not applied for the `@args` # syntax. args = {inherit dns ignore name nodes ports serverDomains services testScript;}; + pkgs = + if stable + then packageSets.stable + else packageSets.unstable; in - specialArgs.nixos-lib.runTest { - hostPkgs = pkgs; + pkgs.testers.runNixOSTest { inherit (args) name; meta.broken = pkgs.lib.mkIf (args.ignore != null) true; node = { - specialArgs = { - inherit - (specialArgs) - pkgsUnstable - vhackPackages - nixpkgs-unstable - ; - inherit nixLib; - }; + specialArgs = special_args; # Use the nixpkgs as constructed by the `nixpkgs.*` options - pkgs = null; + pkgs = packageSets.unstable.lib.mkForce null; }; nodes = pkgs.lib.mkMerge [ @@ -87,7 +87,7 @@ }; name_server = {nodes, ...}: { imports = - specialArgs.extraModules + extra_modules ++ [ ./common/acme/client.nix ./common/dns/server.nix @@ -130,7 +130,7 @@ args.nodes (builtins.mapAttrs (_: _: { imports = - specialArgs.extraModules + extra_modules ++ [ ./common/acme/client.nix ./common/dns/client.nix @@ -325,14 +325,18 @@ ); }; - tests = nixLib.mkByName { + tests = extra_lib.mkByName { baseDirectory = ./by-name; fileName = "test.nix"; finalizeFunction = name: value: - import value (nixLib.warnMerge specialArgs { - inherit pkgs vhack; - inherit (pkgs) lib; - } "the test args set"); + # import value (extra_lib.warnMerge special_args { + # inherit pkgs vhack; + # inherit (pkgs) lib; + # } "the test args set"); + import value { + inherit packageSets vhack sources; + inherit (packageSets.unstable) lib; + }; }; in tests -- cgit v1.3.1