2024-03-04 02:01:00 +01:00
|
|
|
{ pkgs, lib, ... }:
|
2024-03-05 05:36:47 +01:00
|
|
|
let
|
2024-03-20 06:50:41 +01:00
|
|
|
pkgs' = pkgs;
|
|
|
|
|
2024-07-12 13:01:26 +02:00
|
|
|
testLib = pkgs.callPackage ../common.nix {};
|
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
subdomain = "a";
|
|
|
|
domain = "example.com";
|
|
|
|
fqdn = "${subdomain}.${domain}";
|
|
|
|
|
2024-07-12 13:01:26 +02:00
|
|
|
commonTestScript = testLib.accessScript {
|
2024-07-16 10:38:26 +02:00
|
|
|
inherit subdomain domain;
|
2024-07-12 13:01:26 +02:00
|
|
|
hasSSL = { node, ... }: !(isNull node.config.shb.audiobookshelf.ssl);
|
|
|
|
waitForServices = { ... }: [
|
|
|
|
"audiobookshelf.service"
|
|
|
|
"nginx.service"
|
|
|
|
];
|
|
|
|
waitForPorts = { node, ... }: [
|
|
|
|
node.config.shb.audiobookshelf.webPort
|
|
|
|
];
|
|
|
|
# TODO: Test login
|
|
|
|
# extraScript = { ... }: ''
|
|
|
|
# '';
|
|
|
|
};
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-07-16 10:38:26 +02:00
|
|
|
base = testLib.base pkgs' [
|
|
|
|
../../modules/services/audiobookshelf.nix
|
|
|
|
];
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
basic = {
|
|
|
|
shb.audiobookshelf = {
|
|
|
|
enable = true;
|
|
|
|
inherit subdomain domain;
|
|
|
|
};
|
|
|
|
};
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
https = { config, ... }: {
|
|
|
|
shb.audiobookshelf = {
|
|
|
|
ssl = config.shb.certs.certs.selfsigned.n;
|
2024-03-04 02:01:00 +01:00
|
|
|
};
|
2024-06-07 07:22:44 +02:00
|
|
|
};
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
sso = { config, ... }: {
|
|
|
|
shb.audiobookshelf = {
|
|
|
|
authEndpoint = "https://${config.shb.authelia.subdomain}.${config.shb.authelia.domain}";
|
|
|
|
ssoSecretFile = pkgs.writeText "ssoSecretFile" "ssoSecretFile";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
basic = pkgs.testers.runNixOSTest {
|
|
|
|
name = "audiobookshelf-basic";
|
|
|
|
|
2024-07-16 10:38:26 +02:00
|
|
|
nodes.server = {
|
|
|
|
imports = [
|
|
|
|
base
|
|
|
|
basic
|
|
|
|
];
|
|
|
|
};
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
nodes.client = {};
|
|
|
|
|
|
|
|
testScript = commonTestScript;
|
|
|
|
};
|
|
|
|
|
|
|
|
https = pkgs.testers.runNixOSTest {
|
|
|
|
name = "audiobookshelf-https";
|
|
|
|
|
|
|
|
nodes.server = lib.mkMerge [
|
|
|
|
base
|
2024-07-16 10:38:26 +02:00
|
|
|
(testLib.certs domain)
|
2024-06-07 07:22:44 +02:00
|
|
|
basic
|
|
|
|
https
|
|
|
|
];
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
nodes.client = {};
|
2024-03-04 02:01:00 +01:00
|
|
|
|
2024-06-07 07:22:44 +02:00
|
|
|
testScript = commonTestScript;
|
|
|
|
};
|
|
|
|
|
|
|
|
sso = pkgs.testers.runNixOSTest {
|
|
|
|
name = "audiobookshelf-sso";
|
|
|
|
|
2024-07-16 10:38:26 +02:00
|
|
|
nodes.server = { config, ... }: {
|
|
|
|
imports = [
|
|
|
|
base
|
|
|
|
(testLib.certs domain)
|
|
|
|
basic
|
|
|
|
https
|
|
|
|
(testLib.ldap domain pkgs')
|
|
|
|
(testLib.sso domain pkgs' config.shb.certs.certs.selfsigned.n)
|
|
|
|
sso
|
|
|
|
];
|
|
|
|
};
|
2024-03-04 02:01:00 +01:00
|
|
|
|
|
|
|
nodes.client = {};
|
|
|
|
|
2024-03-05 05:36:47 +01:00
|
|
|
testScript = commonTestScript;
|
2024-03-04 02:01:00 +01:00
|
|
|
};
|
|
|
|
}
|