From 356a5584041ece1b26f921febd37ad4120773c04 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Sat, 24 Aug 2024 06:01:28 +0200 Subject: [PATCH] test vaultwarden backup --- test/services/vaultwarden.nix | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/services/vaultwarden.nix b/test/services/vaultwarden.nix index 464606c..8979b7f 100644 --- a/test/services/vaultwarden.nix +++ b/test/services/vaultwarden.nix @@ -87,6 +87,25 @@ let authEndpoint = "https://${config.shb.authelia.subdomain}.${config.shb.authelia.domain}"; }; }; + + backup = { config, ... }: { + imports = [ + ../../modules/blocks/restic.nix + ]; + shb.restic.instances."testinstance" = config.shb.vaultwarden.backup // { + enable = true; + passphraseFile = pkgs.writeText "passphrase" "PassPhrase"; + repositories = [ + { + path = "/opt/repos/A"; + timerConfig = { + OnCalendar = "00:00:00"; + RandomizedDelaySec = "5h"; + }; + } + ]; + }; + }; in { basic = pkgs.testers.runNixOSTest { @@ -168,4 +187,25 @@ in ''; }; }; + + backup = pkgs.testers.runNixOSTest { + name = "vaultwarden_backup"; + + nodes.server = { config, ... }: { + imports = [ + base + basic + backup + ]; + }; + + nodes.client = {}; + + testScript = commonTestScript.override { + extraScript = { proto_fqdn, ... }: '' + with subtest("backup"): + server.succeed("systemctl start restic-backups-testinstance_opt_repos_A") + ''; + }; + }; }