2024-03-04 02:25:26 +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:58:47 +02:00
|
|
|
subdomain = "g";
|
|
|
|
domain = "example.com";
|
|
|
|
fqdn = "${subdomain}.${domain}";
|
|
|
|
|
2024-07-16 10:38:26 +02:00
|
|
|
commonTestScript = lib.makeOverridable testLib.accessScript {
|
|
|
|
inherit subdomain domain;
|
2024-07-12 13:01:26 +02:00
|
|
|
hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl);
|
|
|
|
waitForServices = { ... }: [
|
|
|
|
"phpfpm-grocy.service"
|
|
|
|
"nginx.service"
|
|
|
|
];
|
|
|
|
waitForUnixSocket = { node, ... }: [
|
|
|
|
node.config.services.phpfpm.pools.grocy.socket
|
|
|
|
];
|
|
|
|
# TODO: Test login
|
|
|
|
# extraScript = { ... }: ''
|
|
|
|
# '';
|
|
|
|
};
|
2024-06-07 07:58:47 +02:00
|
|
|
|
2024-07-16 10:38:26 +02:00
|
|
|
base = testLib.base pkgs' [
|
|
|
|
../../modules/services/grocy.nix
|
|
|
|
];
|
2024-06-07 07:58:47 +02:00
|
|
|
|
|
|
|
basic = { config, ... }: {
|
|
|
|
shb.grocy = {
|
|
|
|
enable = true;
|
|
|
|
inherit domain subdomain;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
https = { config, ...}: {
|
|
|
|
shb.grocy = {
|
|
|
|
ssl = config.shb.certs.certs.selfsigned.n;
|
|
|
|
};
|
|
|
|
};
|
2024-03-05 05:36:47 +01:00
|
|
|
in
|
2024-03-04 02:25:26 +01:00
|
|
|
{
|
2024-03-20 06:50:41 +01:00
|
|
|
basic = pkgs.testers.runNixOSTest {
|
2024-07-16 10:38:26 +02:00
|
|
|
name = "grocy_basic";
|
2024-03-04 02:25:26 +01:00
|
|
|
|
2024-07-16 10:38:26 +02:00
|
|
|
nodes.server = {
|
|
|
|
imports = [
|
|
|
|
base
|
|
|
|
basic
|
|
|
|
];
|
|
|
|
};
|
2024-03-04 02:25:26 +01:00
|
|
|
|
|
|
|
nodes.client = {};
|
|
|
|
|
2024-03-05 05:36:47 +01:00
|
|
|
testScript = commonTestScript;
|
2024-03-04 02:25:26 +01:00
|
|
|
};
|
|
|
|
|
2024-06-07 07:58:47 +02:00
|
|
|
https = pkgs.testers.runNixOSTest {
|
2024-07-16 10:38:26 +02:00
|
|
|
name = "grocy_https";
|
|
|
|
|
|
|
|
nodes.server = {
|
|
|
|
imports = [
|
|
|
|
base
|
|
|
|
(testLib.certs domain)
|
|
|
|
basic
|
|
|
|
https
|
|
|
|
];
|
|
|
|
};
|
2024-03-04 02:25:26 +01:00
|
|
|
|
|
|
|
nodes.client = {};
|
|
|
|
|
2024-03-05 05:36:47 +01:00
|
|
|
testScript = commonTestScript;
|
2024-03-04 02:25:26 +01:00
|
|
|
};
|
|
|
|
}
|