Add initialTests parameter that is executed before each process instance is checked, make readiness check for s6 more robust

This commit is contained in:
Sander van der Burg 2021-03-30 19:56:27 +02:00 committed by Sander van der Burg
parent 33ddd66280
commit 34e25ec3f4
2 changed files with 5 additions and 4 deletions

View File

@ -25,12 +25,11 @@ in
pathsInNixDB = [ processesEnvProcessManager processesEnvSystem ];
# TODO: how to determine service readiness of s6?
deployProcessManager = ''
machine.succeed(
"${executeDeploy { inherit profileSettings; processManager = "sysvinit"; processesEnv = processesEnvProcessManager; }}"
)
machine.succeed("sleep 3")
machine.wait_for_file("${profileSettings.params.runtimeDir}/service/.s6-svscan")
'';
deploySystem = ''

View File

@ -11,7 +11,7 @@ let
inherit pkgs system;
};
testSystemVariantForProcessManager = {processManager, profileSettings, exprFile, nixosConfig ? null, systemPackages ? [], readiness, tests}:
testSystemVariantForProcessManager = {processManager, profileSettings, exprFile, nixosConfig ? null, systemPackages ? [], initialTests ? null, readiness, tests}:
let
processManagerModule = builtins.getAttr processManager processManagerModules;
@ -55,6 +55,7 @@ let
''
+ processManagerSettings.deployProcessManager
+ processManagerSettings.deploySystem
+ pkgs.lib.optionalString (initialTests != null) (initialTests profileSettings.params)
# Execute readiness check for all process instances
+ pkgs.lib.concatMapStrings (instanceName:
@ -78,6 +79,7 @@ in
, exprFile
, nixosConfig ? null
, systemPackages ? []
, initialTests ? null
, readiness
, tests
}:
@ -89,7 +91,7 @@ pkgs.lib.genAttrs profiles (profile:
in
pkgs.lib.genAttrs processManagers (processManager:
testSystemVariantForProcessManager {
inherit processManager profileSettings exprFile nixosConfig systemPackages readiness tests;
inherit processManager profileSettings exprFile nixosConfig systemPackages initialTests readiness tests;
}
)
)