Fix test function to work with Nixpkgs 23.05

This commit is contained in:
Sander van der Burg 2023-09-20 18:36:07 +02:00
parent cc90d87001
commit 0e9ec77cc6
5 changed files with 12 additions and 5 deletions

View File

@ -11,7 +11,7 @@ let
inherit pkgs system; inherit pkgs system;
}; };
testSystemVariantForProcessManager = {processManager, profileSettings, exprFile, extraParams ? {}, nixosConfig ? null, systemPackages ? [], initialTests ? null, readiness ? null, tests ? null, postTests ? null}: testSystemVariantForProcessManager = {name, processManager, profileSettings, exprFile, extraParams ? {}, nixosConfig ? null, systemPackages ? [], initialTests ? null, readiness ? null, tests ? null, postTests ? null}:
let let
processManagerModule = builtins.getAttr processManager processManagerModules; processManagerModule = builtins.getAttr processManager processManagerModules;
@ -31,7 +31,9 @@ let
with import "${nixpkgs}/nixos/lib/testing-python.nix" { inherit system; }; with import "${nixpkgs}/nixos/lib/testing-python.nix" { inherit system; };
makeTest { makeTest {
machine = inherit name;
nodes.machine =
{pkgs, lib, ...}: {pkgs, lib, ...}:
{ {
@ -77,13 +79,14 @@ let
let let
instance = builtins.getAttr instanceName processes; instance = builtins.getAttr instanceName processes;
in in
tests ({ inherit instanceName instance; } // processManagerSettings.params) tests ({ inherit instanceName instance processManager; } // processManagerSettings.params)
) (builtins.attrNames processes)) ) (builtins.attrNames processes))
+ pkgs.lib.optionalString (postTests != null) (postTests (processManagerSettings.params // { inherit processes; })); + pkgs.lib.optionalString (postTests != null) (postTests (processManagerSettings.params // { inherit processes; }));
}; };
in in
{ processManagers { name
, processManagers
, profiles , profiles
, exprFile , exprFile
, extraParams ? {} , extraParams ? {}
@ -102,7 +105,7 @@ pkgs.lib.genAttrs profiles (profile:
in in
pkgs.lib.genAttrs processManagers (processManager: pkgs.lib.genAttrs processManagers (processManager:
testSystemVariantForProcessManager { testSystemVariantForProcessManager {
inherit processManager profileSettings exprFile extraParams nixosConfig systemPackages initialTests readiness tests postTests; inherit name processManager profileSettings exprFile extraParams nixosConfig systemPackages initialTests readiness tests postTests;
} }
) )
) )

View File

@ -1,6 +1,7 @@
{ pkgs, testService, processManagers, profiles }: { pkgs, testService, processManagers, profiles }:
testService { testService {
name = "docker";
exprFile = ./processes.nix; exprFile = ./processes.nix;
systemPackages = [ pkgs.docker ]; systemPackages = [ pkgs.docker ];

View File

@ -1,6 +1,7 @@
{ pkgs, testService, processManagers, profiles }: { pkgs, testService, processManagers, profiles }:
testService { testService {
name = "nginx-reverse-proxy-hostbased";
exprFile = ./processes.nix; exprFile = ./processes.nix;
readiness = {instanceName, instance, ...}: readiness = {instanceName, instance, ...}:

View File

@ -41,6 +41,7 @@ let
}; };
in in
testService { testService {
name = "s6-svscan";
exprFile = ./processes.nix; exprFile = ./processes.nix;
systemPackages = [ pkgs.s6-rc ]; systemPackages = [ pkgs.s6-rc ];

View File

@ -26,6 +26,7 @@ let
}; };
in in
testService { testService {
name = "supervisord";
exprFile = ./processes.nix; exprFile = ./processes.nix;
systemPackages = [ pkgs.python3Packages.supervisor ]; systemPackages = [ pkgs.python3Packages.supervisor ];