chore(tests): Make the services in the integration tests only start once they are needed

This commit is contained in:
David Niehues
2025-08-20 16:46:11 +02:00
parent ed4ec9d7dd
commit 3498a6e12c
4 changed files with 59 additions and 27 deletions

View File

@@ -10,7 +10,12 @@ let
in
{
options.services.rosenpassKeyExchange = {
enable = lib.mkEnableOption "rosenpass key-exchange";
create = lib.mkEnableOption "rosenpass key-exchange";
enable = lib.mkOption {
type = lib.types.bool;
description = "Should the service be enabled";
default = true;
};
config = lib.mkOption {
type = lib.types.path;
description = "Path to rosenpass configuration";
@@ -21,10 +26,10 @@ in
};
};
config = lib.mkIf cfg.enable {
config = lib.mkIf cfg.create {
systemd.services.rp-exchange = {
description = "Rosenpass Key Exchanger";
wantedBy = [ "multi-user.target" ];
wantedBy = [ ] ++ lib.optional cfg.enable "multi-user.target"; # If we set enable to this, then the service will be masked and cannot be enabled. Doing it this way allows us to enable it.
requires = [ "network-online.target" ];
script = ''
${cfg.rosenpassVersion}/bin/rosenpass exchange-config ${cfg.config}