From 34e25ec3f4299544794ba3cebb971f568472be91 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Tue, 30 Mar 2021 19:56:27 +0200 Subject: [PATCH] Add initialTests parameter that is executed before each process instance is checked, make readiness check for s6 more robust --- nixproc/backends/s6-rc/test-module/default.nix | 3 +-- nixproc/test-driver/agnostic.nix | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nixproc/backends/s6-rc/test-module/default.nix b/nixproc/backends/s6-rc/test-module/default.nix index 466652d..399a0be 100644 --- a/nixproc/backends/s6-rc/test-module/default.nix +++ b/nixproc/backends/s6-rc/test-module/default.nix @@ -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 = '' diff --git a/nixproc/test-driver/agnostic.nix b/nixproc/test-driver/agnostic.nix index 733b4de..be435a2 100644 --- a/nixproc/test-driver/agnostic.nix +++ b/nixproc/test-driver/agnostic.nix @@ -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; } ) )