1
0
Fork 0

commonalize grocy tests

This commit is contained in:
ibizaman 2024-06-06 22:58:47 -07:00 committed by Pierre Penninckx
parent 30be3d1262
commit f7469cf096

View file

@ -2,6 +2,10 @@
let let
pkgs' = pkgs; pkgs' = pkgs;
subdomain = "g";
domain = "example.com";
fqdn = "${subdomain}.${domain}";
# TODO: Test login # TODO: Test login
commonTestScript = { nodes, ... }: commonTestScript = { nodes, ... }:
let let
@ -38,82 +42,91 @@ let
if response['code'] != 200: if response['code'] != 200:
raise Exception(f"Code is {response['code']}") raise Exception(f"Code is {response['code']}")
''; '';
base = {
imports = [
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
};
}
../../modules/services/grocy.nix
];
# Nginx port.
networking.firewall.allowedTCPPorts = [ 80 443 ];
};
certs = { config, ... }: {
imports = [
../../modules/blocks/ssl.nix
];
shb.certs = {
cas.selfsigned.myca = {
name = "My CA";
};
certs.selfsigned = {
n = {
ca = config.shb.certs.cas.selfsigned.myca;
domain = "*.${domain}";
group = "nginx";
};
};
};
systemd.services.nginx.after = [ config.shb.certs.certs.selfsigned.n.systemdService ];
systemd.services.nginx.requires = [ config.shb.certs.certs.selfsigned.n.systemdService ];
};
basic = { config, ... }: {
shb.grocy = {
enable = true;
inherit domain subdomain;
};
};
https = { config, ...}: {
shb.grocy = {
ssl = config.shb.certs.certs.selfsigned.n;
};
};
in in
{ {
basic = pkgs.testers.runNixOSTest { basic = pkgs.testers.runNixOSTest {
name = "grocy-basic"; name = "grocy-basic";
nodes.server = { config, pkgs, ... }: { nodes.server = lib.mkMerge [
imports = [ base
(pkgs'.path + "/nixos/modules/profiles/headless.nix") basic
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") {
{ options = {
options = { shb.authelia = lib.mkOption { type = lib.types.anything; };
shb.backup = lib.mkOption { type = lib.types.anything; }; };
}; }
} ];
../../modules/services/grocy.nix
];
shb.grocy = {
enable = true;
domain = "example.com";
subdomain = "g";
};
# Nginx port.
networking.firewall.allowedTCPPorts = [ 80 ];
};
nodes.client = {}; nodes.client = {};
testScript = commonTestScript; testScript = commonTestScript;
}; };
cert = pkgs.testers.runNixOSTest { https = pkgs.testers.runNixOSTest {
name = "grocy-cert"; name = "grocy-https";
nodes.server = { config, pkgs, ... }: { nodes.server = lib.mkMerge [
imports = [ base
(pkgs'.path + "/nixos/modules/profiles/headless.nix") certs
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") basic
{ https
options = { {
shb.backup = lib.mkOption { type = lib.types.anything; }; options = {
shb.authelia = lib.mkOption { type = lib.types.anything; }; shb.authelia = lib.mkOption { type = lib.types.anything; };
};
}
../../modules/blocks/nginx.nix
../../modules/blocks/ssl.nix
../../modules/services/grocy.nix
];
shb.certs = {
cas.selfsigned.myca = {
name = "My CA";
}; };
certs.selfsigned = { }
n = { ];
ca = config.shb.certs.cas.selfsigned.myca;
domain = "*.example.com";
group = "nginx";
};
};
};
systemd.services.nginx.after = [ config.shb.certs.certs.selfsigned.n.systemdService ];
systemd.services.nginx.requires = [ config.shb.certs.certs.selfsigned.n.systemdService ];
shb.grocy = {
enable = true;
domain = "example.com";
subdomain = "g";
ssl = config.shb.certs.certs.selfsigned.n;
};
# Nginx port.
networking.firewall.allowedTCPPorts = [ 80 443 ];
shb.nginx.accessLog = true;
};
nodes.client = {}; nodes.client = {};