test: merge functions into lib and set backdoor everywhere

This commit is contained in:
ibizaman 2025-10-11 22:23:28 +02:00 committed by Pierre Penninckx
parent 9892f55ae2
commit 283e12d87d
28 changed files with 238 additions and 272 deletions

View file

@ -296,12 +296,12 @@ let
in { in {
# Test variants (all 6 required) # Test variants (all 6 required)
basic = pkgs.testers.runNixOSTest { ... }; basic = lib.shb.runNixOSTest { ... };
backup = pkgs.testers.runNixOSTest { ... }; backup = lib.shb.runNixOSTest { ... };
https = pkgs.testers.runNixOSTest { ... }; https = lib.shb.runNixOSTest { ... };
ldap = pkgs.testers.runNixOSTest { ... }; ldap = lib.shb.runNixOSTest { ... };
monitoring = pkgs.testers.runNixOSTest { ... }; monitoring = lib.shb.runNixOSTest { ... };
sso = pkgs.testers.runNixOSTest { ... }; sso = lib.shb.runNixOSTest { ... };
} }
``` ```

View file

@ -178,7 +178,9 @@
vm_test = name: path: flattenAttrs "vm_${name}" ( vm_test = name: path: flattenAttrs "vm_${name}" (
import path { import path {
inherit pkgs; inherit pkgs;
inherit (pkgs) lib; lib = pkgs.lib // {
shb = pkgs.callPackage ./test/common.nix {};
};
} }
); );

View file

@ -1,7 +1,5 @@
{ pkgs, lib, ... }: { pkgs, lib }:
let let
testLib = pkgs.callPackage ../../../test/common.nix {};
inherit (lib) concatMapStringsSep getAttrFromPath mkIf optionalAttrs setAttrByPath; inherit (lib) concatMapStringsSep getAttrFromPath mkIf optionalAttrs setAttrByPath;
in in
{ name, { name,
@ -14,11 +12,11 @@ in
], ],
settings, # { repository, config } -> attrset settings, # { repository, config } -> attrset
extraConfig ? null, # { username, config } -> attrset extraConfig ? null, # { username, config } -> attrset
}: pkgs.testers.runNixOSTest { }: lib.shb.runNixOSTest {
inherit name; inherit name;
nodes.machine = { config, ... }: { nodes.machine = { config, ... }: {
imports = [ testLib.baseImports ] ++ modules; imports = [ lib.shb.baseImports ] ++ modules;
config = lib.mkMerge [ config = lib.mkMerge [
(setAttrByPath providerRoot { (setAttrByPath providerRoot {

View file

@ -1,7 +1,5 @@
{ pkgs, lib, ... }: { pkgs, lib }:
let let
testLib = pkgs.callPackage ../../../test/common.nix {};
inherit (lib) getAttrFromPath mkIf optionalAttrs setAttrByPath; inherit (lib) getAttrFromPath mkIf optionalAttrs setAttrByPath;
in in
{ name, { name,
@ -11,11 +9,11 @@ in
modules ? [], modules ? [],
database ? "me", database ? "me",
settings, # { repository, config } -> attrset settings, # { repository, config } -> attrset
}: pkgs.testers.runNixOSTest { }: lib.shb.runNixOSTest {
inherit name; inherit name;
nodes.machine = { config, ... }: { nodes.machine = { config, ... }: {
imports = [ testLib.baseImports ] ++ modules; imports = [ lib.shb.baseImports ] ++ modules;
config = lib.mkMerge [ config = lib.mkMerge [
(setAttrByPath providerRoot { (setAttrByPath providerRoot {
request = (getAttrFromPath requesterRoot config).request; request = (getAttrFromPath requesterRoot config).request;

View file

@ -1,7 +1,5 @@
{ pkgs, lib, ... }: { pkgs, lib }:
let let
testLib = pkgs.callPackage ../../../test/common.nix {};
inherit (lib) getAttrFromPath setAttrByPath; inherit (lib) getAttrFromPath setAttrByPath;
inherit (lib) mkIf; inherit (lib) mkIf;
in in
@ -13,11 +11,11 @@ in
group ? "root", group ? "root",
mode ? "0400", mode ? "0400",
restartUnits ? [ "myunit.service" ], restartUnits ? [ "myunit.service" ],
}: pkgs.testers.runNixOSTest { }: lib.shb.runNixOSTest {
name = "secret_${name}_${owner}_${group}_${mode}"; name = "secret_${name}_${owner}_${group}_${mode}";
nodes.machine = { config, ... }: { nodes.machine = { config, ... }: {
imports = [ testLib.baseImports ] ++ modules; imports = [ lib.shb.baseImports ] ++ modules;
config = lib.mkMerge [ config = lib.mkMerge [
(setAttrByPath configRoot { (setAttrByPath configRoot {
A = { A = {

View file

@ -1,11 +1,11 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
pkgs' = pkgs; pkgs' = pkgs;
ldapAdminPassword = "ldapAdminPassword"; ldapAdminPassword = "ldapAdminPassword";
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "authelia-basic"; name = "authelia-basic";
nodes.machine = { config, pkgs, ... }: { nodes.machine = { config, pkgs, ... }: {

View file

@ -54,7 +54,7 @@ in
generator = shblib.replaceSecretsFormatAdapter (shblib.formatXML {enclosingRoot = "Root";}); generator = shblib.replaceSecretsFormatAdapter (shblib.formatXML {enclosingRoot = "Root";});
}; };
in in
pkgs.testers.runNixOSTest { lib.shb.runNixOSTest {
name = "lib-template"; name = "lib-template";
nodes.machine = { config, pkgs, ... }: nodes.machine = { config, pkgs, ... }:
{ {

View file

@ -6,7 +6,7 @@ let
charliePassword = "CharliePassword"; charliePassword = "CharliePassword";
in in
{ {
auth = pkgs.testers.runNixOSTest { auth = lib.shb.runNixOSTest {
name = "ldap-auth"; name = "ldap-auth";
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {

View file

@ -39,7 +39,7 @@ let
); );
in in
{ {
default = pkgs.testers.runNixOSTest { default = lib.shb.runNixOSTest {
name = "mitmdump-default"; name = "mitmdump-default";
nodes.machine = { config, pkgs, ... }: { nodes.machine = { config, pkgs, ... }: {

View file

@ -1,9 +1,9 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
pkgs' = pkgs; pkgs' = pkgs;
in in
{ {
peerWithoutUser = pkgs.testers.runNixOSTest { peerWithoutUser = lib.shb.runNixOSTest {
name = "postgresql-peerWithoutUser"; name = "postgresql-peerWithoutUser";
nodes.machine = { config, pkgs, ... }: { nodes.machine = { config, pkgs, ... }: {
@ -40,7 +40,7 @@ in
''; '';
}; };
peerAuth = pkgs.testers.runNixOSTest { peerAuth = lib.shb.runNixOSTest {
name = "postgresql-peerAuth"; name = "postgresql-peerAuth";
nodes.machine = { config, pkgs, ... }: { nodes.machine = { config, pkgs, ... }: {
@ -90,7 +90,7 @@ in
''; '';
}; };
tcpIPWithoutPasswordAuth = pkgs.testers.runNixOSTest { tcpIPWithoutPasswordAuth = lib.shb.runNixOSTest {
name = "postgresql-tcpIpWithoutPasswordAuth"; name = "postgresql-tcpIpWithoutPasswordAuth";
nodes.machine = { config, pkgs, ... }: { nodes.machine = { config, pkgs, ... }: {
@ -128,7 +128,7 @@ in
''; '';
}; };
tcpIPPasswordAuth = pkgs.testers.runNixOSTest { tcpIPPasswordAuth = lib.shb.runNixOSTest {
name = "postgresql-tcpIPPasswordAuth"; name = "postgresql-tcpIPPasswordAuth";
nodes.machine = { config, pkgs, ... }: { nodes.machine = { config, pkgs, ... }: {

View file

@ -1,8 +1,8 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; testLib = pkgs.callPackage ../common.nix {};
commonTest = user: pkgs.testers.runNixOSTest { commonTest = user: lib.shb.runNixOSTest {
name = "restic_backupAndRestore_${user}"; name = "restic_backupAndRestore_${user}";
nodes.machine = { config, ... }: { nodes.machine = { config, ... }: {

View file

@ -1,9 +1,9 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
pkgs' = pkgs; pkgs' = pkgs;
in in
{ {
test = pkgs.testers.runNixOSTest { test = lib.shb.runNixOSTest {
name = "ssl-test"; name = "ssl-test";
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {

View file

@ -151,6 +151,10 @@ in
{ {
inherit baseImports accessScript; inherit baseImports accessScript;
runNixOSTest = args: pkgs.testers.runNixOSTest ({
interactive.sshBackdoor.enable = true;
} // args);
mkScripts = args: mkScripts = args:
{ {
access = accessScript args; access = accessScript args;

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { pkgs, ... }:
let let
contracts = pkgs.callPackage ../../modules/contracts {}; contracts = pkgs.callPackage ../../modules/contracts {};
in in

View file

@ -3,10 +3,8 @@ let
healthUrl = "/health"; healthUrl = "/health";
loginUrl = "/UI/Login"; loginUrl = "/UI/Login";
testLib = pkgs.callPackage ../common.nix {};
# TODO: Test login # TODO: Test login
commonTestScript = appname: cfgPathFn: testLib.mkScripts { commonTestScript = appname: cfgPathFn: lib.shb.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.arr.${appname}.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.arr.${appname}.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"${appname}.service" "${appname}.service"
@ -44,7 +42,7 @@ let
basic = appname: { config, ... }: { basic = appname: { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/arr.nix ../../modules/services/arr.nix
]; ];
@ -62,8 +60,8 @@ let
clientLogin = appname: { config, ... }: { clientLogin = appname: { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
@ -83,7 +81,7 @@ let
}; };
}; };
basicTest = appname: cfgPathFn: pkgs.testers.runNixOSTest { basicTest = appname: cfgPathFn: lib.shb.runNixOSTest {
name = "arr_${appname}_basic"; name = "arr_${appname}_basic";
nodes.client = { nodes.client = {
@ -100,13 +98,13 @@ let
testScript = (commonTestScript appname cfgPathFn).access; testScript = (commonTestScript appname cfgPathFn).access;
}; };
backupTest = appname: cfgPathFn: pkgs.testers.runNixOSTest { backupTest = appname: cfgPathFn: lib.shb.runNixOSTest {
name = "arr_${appname}_backup"; name = "arr_${appname}_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
(basic appname) (basic appname)
(testLib.backup config.shb.arr.${appname}.backup) (lib.shb.backup config.shb.arr.${appname}.backup)
]; ];
}; };
@ -121,13 +119,13 @@ let
}; };
}; };
httpsTest = appname: cfgPathFn: pkgs.testers.runNixOSTest { httpsTest = appname: cfgPathFn: lib.shb.runNixOSTest {
name = "arr_${appname}_https"; name = "arr_${appname}_https";
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
(basic appname) (basic appname)
testLib.certs lib.shb.certs
(https appname) (https appname)
]; ];
}; };
@ -143,16 +141,16 @@ let
}; };
}; };
ssoTest = appname: cfgPathFn: pkgs.testers.runNixOSTest { ssoTest = appname: cfgPathFn: lib.shb.runNixOSTest {
name = "arr_${appname}_sso"; name = "arr_${appname}_sso";
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
(basic appname) (basic appname)
testLib.certs lib.shb.certs
(https appname) (https appname)
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
(sso appname) (sso appname)
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.accessScript {
commonTestScript = testLib.accessScript {
hasSSL = { node, ... }: !(isNull node.config.shb.audiobookshelf.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.audiobookshelf.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"audiobookshelf.service" "audiobookshelf.service"
@ -18,7 +16,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/audiobookshelf.nix ../../modules/services/audiobookshelf.nix
]; ];
@ -33,8 +31,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -89,7 +87,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "audiobookshelf-basic"; name = "audiobookshelf-basic";
nodes.client = { nodes.client = {
@ -107,13 +105,13 @@ in
testScript = commonTestScript; testScript = commonTestScript;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "audiobookshelf-https"; name = "audiobookshelf-https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -123,16 +121,16 @@ in
testScript = commonTestScript; testScript = commonTestScript;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "audiobookshelf-sso"; name = "audiobookshelf-sso";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.deluge.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.deluge.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"nginx.service" "nginx.service"
@ -69,7 +67,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/deluge.nix ../../modules/services/deluge.nix
]; ];
@ -100,8 +98,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
subdomain = "d"; subdomain = "d";
@ -146,7 +144,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "deluge_basic"; name = "deluge_basic";
nodes.client = { nodes.client = {
@ -163,13 +161,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "deluge_backup"; name = "deluge_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.deluge.backup) (lib.shb.backup config.shb.deluge.backup)
]; ];
}; };
@ -178,13 +176,13 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "deluge_https"; name = "deluge_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -194,16 +192,16 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "deluge_sso"; name = "deluge_sso";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };
@ -215,13 +213,13 @@ in
}; };
}; };
prometheus = pkgs.testers.runNixOSTest { prometheus = lib.shb.runNixOSTest {
name = "deluge_https"; name = "deluge_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
prometheus prometheus
]; ];

View file

@ -1,10 +1,8 @@
{ pkgs, ... }: { lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {};
adminPassword = "AdminPassword"; adminPassword = "AdminPassword";
commonTestScript = testLib.mkScripts { commonTestScript = lib.shb.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.forgejo.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.forgejo.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"forgejo.service" "forgejo.service"
@ -21,7 +19,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/forgejo.nix ../../modules/services/forgejo.nix
]; ];
@ -71,8 +69,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
subdomain = "f"; subdomain = "f";
@ -152,7 +150,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "forgejo_basic"; name = "forgejo_basic";
nodes.client = { nodes.client = {
@ -169,13 +167,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "forgejo_backup"; name = "forgejo_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.forgejo.backup) (lib.shb.backup config.shb.forgejo.backup)
]; ];
}; };
@ -184,13 +182,13 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "forgejo_https"; name = "forgejo_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -200,15 +198,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
ldap = pkgs.testers.runNixOSTest { ldap = lib.shb.runNixOSTest {
name = "forgejo_ldap"; name = "forgejo_ldap";
interactive.sshBackdoor.enable = true;
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.ldap lib.shb.ldap
ldap ldap
]; ];
}; };
@ -217,8 +213,8 @@ in
imports = [ imports = [
({ config, ... }: { ({ config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
@ -262,16 +258,16 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "forgejo_sso"; name = "forgejo_sso";
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"phpfpm-grocy.service" "phpfpm-grocy.service"
@ -15,7 +13,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/grocy.nix ../../modules/services/grocy.nix
]; ];
@ -31,8 +29,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -65,7 +63,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "grocy_basic"; name = "grocy_basic";
nodes.client = { nodes.client = {
@ -82,13 +80,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "grocy_https"; name = "grocy_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.hledger.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.hledger.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"hledger-web.service" "hledger-web.service"
@ -12,7 +10,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/hledger.nix ../../modules/services/hledger.nix
]; ];
@ -28,8 +26,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
@ -59,7 +57,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "hledger_basic"; name = "hledger_basic";
nodes.client = { nodes.client = {
@ -77,13 +75,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "hledger_backup"; name = "hledger_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.hledger.backup) (lib.shb.backup config.shb.hledger.backup)
]; ];
}; };
@ -92,13 +90,13 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "hledger_https"; name = "hledger_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -108,16 +106,16 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "hledger_sso"; name = "hledger_sso";
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.home-assistant.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.home-assistant.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"home-assistant.service" "home-assistant.service"
@ -15,7 +13,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/home-assistant.nix ../../modules/services/home-assistant.nix
]; ];
@ -40,8 +38,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -151,7 +149,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "homeassistant_basic"; name = "homeassistant_basic";
nodes.client = { nodes.client = {
@ -168,13 +166,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "homeassistant_backup"; name = "homeassistant_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.home-assistant.backup) (lib.shb.backup config.shb.home-assistant.backup)
]; ];
}; };
@ -183,13 +181,13 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "homeassistant_https"; name = "homeassistant_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -199,13 +197,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
ldap = pkgs.testers.runNixOSTest { ldap = lib.shb.runNixOSTest {
name = "homeassistant_ldap"; name = "homeassistant_ldap";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.ldap lib.shb.ldap
ldap ldap
]; ];
}; };
@ -217,16 +215,16 @@ in
# Not yet supported # Not yet supported
# #
# sso = pkgs.testers.runNixOSTest { # sso = lib.shb.runNixOSTest {
# name = "vaultwarden_sso"; # name = "vaultwarden_sso";
# #
# nodes.server = lib.mkMerge [ # nodes.server = lib.mkMerge [
# basic # basic
# (testLib.certs domain) # (lib.shb.certs domain)
# https # https
# ldap # ldap
# (testLib.ldap domain pkgs') # (lib.shb.ldap domain pkgs')
# (testLib.sso domain pkgs' config.shb.certs.certs.selfsigned.n) # (lib.shb.sso domain pkgs' config.shb.certs.certs.selfsigned.n)
# sso # sso
# ]; # ];
# #
@ -235,7 +233,7 @@ in
# testScript = commonTestScript.access; # testScript = commonTestScript.access;
# }; # };
voice = pkgs.testers.runNixOSTest { voice = lib.shb.runNixOSTest {
name = "homeassistant_voice"; name = "homeassistant_voice";
nodes.server = { nodes.server = {

View file

@ -1,11 +1,9 @@
{ pkgs, lib }: { pkgs, lib }:
let let
testLib = pkgs.callPackage ../common.nix {};
subdomain = "i"; subdomain = "i";
domain = "example.com"; domain = "example.com";
commonTestScript = testLib.accessScript { commonTestScript = lib.shb.accessScript {
hasSSL = { node, ... }: !(isNull node.config.shb.immich.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.immich.ssl);
waitForServices = { ... }: [ "immich-server.service" "postgresql.service" "nginx.service" ]; waitForServices = { ... }: [ "immich-server.service" "postgresql.service" "nginx.service" ];
waitForPorts = { ... }: [ 2283 80 ]; waitForPorts = { ... }: [ 2283 80 ];
@ -14,7 +12,7 @@ let
base = { config, ... }: { base = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/immich.nix ../../modules/services/immich.nix
]; ];
@ -45,7 +43,7 @@ let
https = { config, ... }: { https = { config, ... }: {
imports = [ imports = [
base base
testLib.certs lib.shb.certs
]; ];
test.hasSSL = true; test.hasSSL = true;
@ -55,15 +53,15 @@ let
backup = { config, ... }: { backup = { config, ... }: {
imports = [ imports = [
https https
(testLib.backup config.shb.immich.backup) (lib.shb.backup config.shb.immich.backup)
]; ];
}; };
sso = { config, ... }: { sso = { config, ... }: {
imports = [ imports = [
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
]; ];
shb.immich.sso = { shb.immich.sso = {
@ -137,7 +135,7 @@ in
nodes.server = backup; nodes.server = backup;
nodes.client = {}; nodes.client = {};
testScript = (testLib.mkScripts { testScript = (lib.shb.mkScripts {
hasSSL = args: !(isNull args.node.config.shb.immich.ssl); hasSSL = args: !(isNull args.node.config.shb.immich.ssl);
waitForServices = args: [ "immich-server.service" "postgresql.service" "nginx.service" ]; waitForServices = args: [ "immich-server.service" "postgresql.service" "nginx.service" ];
waitForPorts = args: [ 2283 80 ]; waitForPorts = args: [ 2283 80 ];

View file

@ -1,10 +1,8 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {};
port = 9096; port = 9096;
commonTestScript = testLib.mkScripts { commonTestScript = lib.shb.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.jellyfin.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.jellyfin.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"jellyfin.service" "jellyfin.service"
@ -39,7 +37,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/jellyfin.nix ../../modules/services/jellyfin.nix
]; ];
test = { test = {
@ -69,7 +67,7 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -152,10 +150,9 @@ let
}; };
}; };
jellyfinTest = name: { nodes, testScript }: pkgs.testers.runNixOSTest { jellyfinTest = name: { nodes, testScript }: lib.shb.runNixOSTest {
name = "jellyfin_${name}"; name = "jellyfin_${name}";
interactive.sshBackdoor.enable = true;
interactive.nodes.server = { interactive.nodes.server = {
environment.systemPackages = [ environment.systemPackages = [
pkgs.sqlite pkgs.sqlite
@ -186,7 +183,7 @@ in
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.jellyfin.backup) (lib.shb.backup config.shb.jellyfin.backup)
]; ];
}; };
@ -199,14 +196,14 @@ in
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
nodes.client = { config, lib, ... }: { nodes.client = { config, lib, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
clientLogin clientLogin
]; ];
}; };
@ -218,7 +215,7 @@ in
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.ldap lib.shb.ldap
ldap ldap
]; ];
}; };
@ -232,10 +229,10 @@ in
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };

View file

@ -1,10 +1,8 @@
{ pkgs, ... }: { lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {};
password = "securepw"; password = "securepw";
commonTestScript = testLib.accessScript { commonTestScript = lib.shb.accessScript {
hasSSL = { node, ... }: !(isNull node.config.shb.monitoring.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.monitoring.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"grafana.service" "grafana.service"
@ -45,12 +43,12 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "monitoring_basic"; name = "monitoring_basic";
nodes.server = { nodes.server = {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/monitoring.nix ../../modules/blocks/monitoring.nix
basic basic
]; ];
@ -61,14 +59,14 @@ in
testScript = commonTestScript; testScript = commonTestScript;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "monitoring_https"; name = "monitoring_https";
nodes.server = { nodes.server = {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/monitoring.nix ../../modules/blocks/monitoring.nix
testLib.certs lib.shb.certs
basic basic
https https
]; ];

View file

@ -1,12 +1,10 @@
{ pkgs, lib, ... }: { lib, ... }:
let let
adminUser = "root"; adminUser = "root";
adminPass = "rootpw"; adminPass = "rootpw";
oidcSecret = "oidcSecret"; oidcSecret = "oidcSecret";
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.nextcloud.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.nextcloud.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"phpfpm-nextcloud.service" "phpfpm-nextcloud.service"
@ -91,7 +89,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/services/nextcloud-server.nix ../../modules/services/nextcloud-server.nix
]; ];
@ -123,8 +121,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -153,8 +151,8 @@ let
clientLdapLogin = { config, ... }: { clientLdapLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -190,8 +188,8 @@ let
clientSsoLogin = { config, ... }: { clientSsoLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
@ -365,7 +363,7 @@ let
''; '';
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "nextcloud_basic"; name = "nextcloud_basic";
nodes.client = { nodes.client = {
@ -382,7 +380,7 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
cron = pkgs.testers.runNixOSTest { cron = lib.shb.runNixOSTest {
name = "nextcloud_cron"; name = "nextcloud_cron";
nodes.server = { nodes.server = {
@ -418,13 +416,13 @@ in
}; };
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "nextcloud_backup"; name = "nextcloud_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.nextcloud.backup) (lib.shb.backup config.shb.nextcloud.backup)
]; ];
}; };
@ -433,13 +431,13 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "nextcloud_https"; name = "nextcloud_https";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -450,13 +448,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
previewGenerator = pkgs.testers.runNixOSTest { previewGenerator = lib.shb.runNixOSTest {
name = "nextcloud_previewGenerator"; name = "nextcloud_previewGenerator";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
previewgenerator previewgenerator
]; ];
@ -467,13 +465,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
externalStorage = pkgs.testers.runNixOSTest { externalStorage = lib.shb.runNixOSTest {
name = "nextcloud_externalStorage"; name = "nextcloud_externalStorage";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
externalstorage externalstorage
]; ];
@ -487,13 +485,13 @@ in
# TODO: fix memories app # TODO: fix memories app
# See https://github.com/ibizaman/selfhostblocks/issues/476 # See https://github.com/ibizaman/selfhostblocks/issues/476
# memories = pkgs.testers.runNixOSTest { # memories = lib.shb.runNixOSTest {
# name = "nextcloud_memories"; # name = "nextcloud_memories";
# nodes.server = { # nodes.server = {
# imports = [ # imports = [
# basic # basic
# testLib.certs # lib.shb.certs
# https # https
# memories # memories
# ]; # ];
@ -504,13 +502,13 @@ in
# testScript = commonTestScript.access; # testScript = commonTestScript.access;
# }; # };
recognize = pkgs.testers.runNixOSTest { recognize = lib.shb.runNixOSTest {
name = "nextcloud_recognize"; name = "nextcloud_recognize";
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
recognize recognize
]; ];
@ -521,15 +519,15 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
ldap = pkgs.testers.runNixOSTest { ldap = lib.shb.runNixOSTest {
name = "nextcloud_ldap"; name = "nextcloud_ldap";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
ldap ldap
]; ];
}; };
@ -543,18 +541,16 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "nextcloud_sso"; name = "nextcloud_sso";
interactive.sshBackdoor.enable = true;
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
({ config, ... }: { ({ config, ... }: {
networking.hosts = { networking.hosts = {
@ -578,7 +574,7 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
prometheus = pkgs.testers.runNixOSTest { prometheus = lib.shb.runNixOSTest {
name = "nextcloud_prometheus"; name = "nextcloud_prometheus";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {

View file

@ -1,10 +1,8 @@
{ pkgs, ... }: { lib, ... }:
let let
oidcSecret = "oidcSecret"; oidcSecret = "oidcSecret";
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.open-webui.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.open-webui.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"open-webui.service" "open-webui.service"
@ -17,7 +15,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/open-webui.nix ../../modules/services/open-webui.nix
]; ];
@ -58,8 +56,8 @@ let
clientLoginSso = { config, ... }: { clientLoginSso = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
test = { test = {
@ -127,7 +125,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "open-webui_basic"; name = "open-webui_basic";
nodes.client = {}; nodes.client = {};
@ -140,13 +138,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "open-webui_backup"; name = "open-webui_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.open-webui.backup) (lib.shb.backup config.shb.open-webui.backup)
]; ];
}; };
@ -155,14 +153,14 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "open-webui_https"; name = "open-webui_https";
nodes.client = {}; nodes.client = {};
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -170,9 +168,8 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "open-webui_sso"; name = "open-webui_sso";
interactive.sshBackdoor.enable = true;
nodes.client = { nodes.client = {
imports = [ imports = [
@ -182,11 +179,11 @@ in
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
ldap ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.pinchflat.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.pinchflat.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"pinchflat.service" "pinchflat.service"
@ -15,7 +13,7 @@ let
basic = { config, ... }: { basic = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/pinchflat.nix ../../modules/services/pinchflat.nix
]; ];
@ -49,8 +47,8 @@ let
clientLogin = { config, ... }: { clientLogin = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
subdomain = "p"; subdomain = "p";
@ -85,8 +83,8 @@ let
clientLoginSso = { config, ... }: { clientLoginSso = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
testLib.clientLoginModule lib.shb.clientLoginModule
]; ];
test = { test = {
subdomain = "p"; subdomain = "p";
@ -134,7 +132,7 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "pinchflat_basic"; name = "pinchflat_basic";
nodes.client = { nodes.client = {
@ -151,13 +149,13 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "pinchflat_backup"; name = "pinchflat_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
basic basic
(testLib.backup config.shb.pinchflat.backup) (lib.shb.backup config.shb.pinchflat.backup)
]; ];
}; };
@ -166,7 +164,7 @@ in
testScript = commonTestScript.backup; testScript = commonTestScript.backup;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "pinchflat_https"; name = "pinchflat_https";
nodes.client = { nodes.client = {
@ -177,7 +175,7 @@ in
nodes.server = { nodes.server = {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
]; ];
}; };
@ -185,7 +183,7 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "pinchflat_sso"; name = "pinchflat_sso";
nodes.client = { nodes.client = {
@ -196,11 +194,11 @@ in
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
basic basic
testLib.certs lib.shb.certs
https https
testLib.ldap lib.shb.ldap
ldap ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { lib, ... }:
let let
testLib = pkgs.callPackage ../common.nix {}; commonTestScript = lib.shb.mkScripts {
commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.vaultwarden.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.vaultwarden.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"vaultwarden.service" "vaultwarden.service"
@ -87,12 +85,12 @@ let
}; };
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = lib.shb.runNixOSTest {
name = "vaultwarden_basic"; name = "vaultwarden_basic";
nodes.server = { nodes.server = {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/vaultwarden.nix ../../modules/services/vaultwarden.nix
basic basic
@ -104,15 +102,15 @@ in
testScript = commonTestScript.access; testScript = commonTestScript.access;
}; };
https = pkgs.testers.runNixOSTest { https = lib.shb.runNixOSTest {
name = "vaultwarden_https"; name = "vaultwarden_https";
nodes.server = { nodes.server = {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/vaultwarden.nix ../../modules/services/vaultwarden.nix
testLib.certs lib.shb.certs
basic basic
https https
]; ];
@ -125,11 +123,11 @@ in
# Not yet supported # Not yet supported
# #
# ldap = pkgs.testers.runNixOSTest { # ldap = lib.shb.runNixOSTest {
# name = "vaultwarden_ldap"; # name = "vaultwarden_ldap";
# #
# nodes.server = lib.mkMerge [ # nodes.server = lib.mkMerge [
# testLib.baseModule # lib.shb.baseModule
# ../../modules/blocks/hardcodedsecret.nix # ../../modules/blocks/hardcodedsecret.nix
# ../../modules/services/vaultwarden.nix # ../../modules/services/vaultwarden.nix
# basic # basic
@ -141,19 +139,19 @@ in
# testScript = commonTestScript.access; # testScript = commonTestScript.access;
# }; # };
sso = pkgs.testers.runNixOSTest { sso = lib.shb.runNixOSTest {
name = "vaultwarden_sso"; name = "vaultwarden_sso";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/vaultwarden.nix ../../modules/services/vaultwarden.nix
testLib.certs lib.shb.certs
basic basic
https https
testLib.ldap lib.shb.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (lib.shb.sso config.shb.certs.certs.selfsigned.n)
sso sso
]; ];
}; };
@ -180,16 +178,16 @@ in
}; };
}; };
backup = pkgs.testers.runNixOSTest { backup = lib.shb.runNixOSTest {
name = "vaultwarden_backup"; name = "vaultwarden_backup";
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
testLib.baseModule lib.shb.baseModule
../../modules/blocks/hardcodedsecret.nix ../../modules/blocks/hardcodedsecret.nix
../../modules/services/vaultwarden.nix ../../modules/services/vaultwarden.nix
basic basic
(testLib.backup config.shb.vaultwarden.backup) (lib.shb.backup config.shb.vaultwarden.backup)
]; ];
}; };