selfhostblocks/test/services/grocy.nix
2025-01-23 21:14:50 +01:00

70 lines
1.3 KiB
Nix

{ pkgs, lib, ... }:
let
testLib = pkgs.callPackage ../common.nix {};
commonTestScript = lib.makeOverridable testLib.accessScript {
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 = { ... }: ''
# '';
};
basic = { config, ... }: {
test = {
subdomain = "g";
};
shb.grocy = {
enable = true;
inherit (config.test) subdomain domain;
};
};
https = { config, ...}: {
shb.grocy = {
ssl = config.shb.certs.certs.selfsigned.n;
};
};
in
{
basic = pkgs.testers.runNixOSTest {
name = "grocy_basic";
nodes.server = {
imports = [
testLib.baseModule
../../modules/services/grocy.nix
basic
];
};
nodes.client = {};
testScript = commonTestScript;
};
https = pkgs.testers.runNixOSTest {
name = "grocy_https";
nodes.server = {
imports = [
testLib.baseModule
../../modules/services/grocy.nix
testLib.certs
basic
https
];
};
nodes.client = {};
testScript = commonTestScript;
};
}