From 8d6f38a6c75e6ce13b4ae32520d608d0e3d2310b Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 18 Nov 2025 22:59:26 +0100 Subject: [PATCH] tests: use shb.lib everywhere --- docs/contracts.md | 2 +- test/blocks/borgbackup.nix | 6 ++---- test/blocks/restic.nix | 6 ++---- test/services/karakeep.nix | 30 ++++++++++++++---------------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/docs/contracts.md b/docs/contracts.md index 8f438a9..6a42a1a 100644 --- a/docs/contracts.md +++ b/docs/contracts.md @@ -455,7 +455,7 @@ in modules ? [], owner ? "root", content ? "secretPasswordA", - }: pkgs.testers.runNixOSTest { + }: lib.shb.runNixOSTest { inherit name; nodes.machine = { config, ... }: { diff --git a/test/blocks/borgbackup.nix b/test/blocks/borgbackup.nix index 6c1cb38..66cd3c2 100644 --- a/test/blocks/borgbackup.nix +++ b/test/blocks/borgbackup.nix @@ -1,7 +1,5 @@ -{ pkgs, lib, ... }: +{ lib, ... }: let - testLib = pkgs.callPackage ../common.nix { }; - commonTest = user: lib.shb.runNixOSTest { @@ -11,7 +9,7 @@ let { config, ... }: { imports = [ - testLib.baseImports + lib.shb.baseImports ../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/borgbackup.nix diff --git a/test/blocks/restic.nix b/test/blocks/restic.nix index 76265d1..2b5ded0 100644 --- a/test/blocks/restic.nix +++ b/test/blocks/restic.nix @@ -1,7 +1,5 @@ -{ pkgs, lib, ... }: +{ lib, ... }: let - testLib = pkgs.callPackage ../common.nix { }; - commonTest = user: lib.shb.runNixOSTest { @@ -11,7 +9,7 @@ let { config, ... }: { imports = [ - testLib.baseImports + lib.shb.baseImports ../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/restic.nix diff --git a/test/services/karakeep.nix b/test/services/karakeep.nix index b99e7f5..7e4063e 100644 --- a/test/services/karakeep.nix +++ b/test/services/karakeep.nix @@ -1,11 +1,9 @@ -{ pkgs, ... }: +{ lib, ... }: let nextauthSecret = "nextauthSecret"; oidcSecret = "oidcSecret"; - testLib = pkgs.callPackage ../common.nix { }; - - commonTestScript = testLib.mkScripts { + commonTestScript = lib.shb.mkScripts { hasSSL = { node, ... }: !(isNull node.config.shb.karakeep.ssl); waitForServices = { ... }: @@ -27,7 +25,7 @@ let { config, ... }: { imports = [ - testLib.baseModule + lib.shb.baseModule ../../modules/services/karakeep.nix ]; @@ -79,8 +77,8 @@ let { config, ... }: { imports = [ - testLib.baseModule - testLib.clientLoginModule + lib.shb.baseModule + lib.shb.clientLoginModule ]; test = { subdomain = "k"; @@ -173,7 +171,7 @@ let }; in { - basic = pkgs.testers.runNixOSTest { + basic = lib.shb.runNixOSTest { name = "karakeep_basic"; nodes.client = { }; @@ -186,7 +184,7 @@ in testScript = commonTestScript.access; }; - backup = pkgs.testers.runNixOSTest { + backup = lib.shb.runNixOSTest { name = "karakeep_backup"; nodes.server = @@ -194,7 +192,7 @@ in { imports = [ basic - (testLib.backup config.shb.karakeep.backup) + (lib.shb.backup config.shb.karakeep.backup) ]; }; @@ -203,14 +201,14 @@ in testScript = commonTestScript.backup; }; - https = pkgs.testers.runNixOSTest { + https = lib.shb.runNixOSTest { name = "karakeep_https"; nodes.client = { }; nodes.server = { imports = [ basic - testLib.certs + lib.shb.certs https ]; }; @@ -218,7 +216,7 @@ in testScript = commonTestScript.access; }; - sso = pkgs.testers.runNixOSTest { + sso = lib.shb.runNixOSTest { name = "karakeep_sso"; interactive.sshBackdoor.enable = true; @@ -234,11 +232,11 @@ in { imports = [ basic - testLib.certs + lib.shb.certs https - testLib.ldap + lib.shb.ldap ldap - (testLib.sso config.shb.certs.certs.selfsigned.n) + (lib.shb.sso config.shb.certs.certs.selfsigned.n) sso ];