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
pkgs' = pkgs;
subdomain = "g";
domain = "example.com";
fqdn = "${subdomain}.${domain}";
# TODO: Test login
commonTestScript = { nodes, ... }:
let
@ -38,12 +42,8 @@ let
if response['code'] != 200:
raise Exception(f"Code is {response['code']}")
'';
in
{
basic = pkgs.testers.runNixOSTest {
name = "grocy-basic";
nodes.server = { config, pkgs, ... }: {
base = {
imports = [
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
@ -55,36 +55,13 @@ in
../../modules/services/grocy.nix
];
shb.grocy = {
enable = true;
domain = "example.com";
subdomain = "g";
};
# Nginx port.
networking.firewall.allowedTCPPorts = [ 80 ];
networking.firewall.allowedTCPPorts = [ 80 443 ];
};
nodes.client = {};
testScript = commonTestScript;
};
cert = pkgs.testers.runNixOSTest {
name = "grocy-cert";
nodes.server = { config, pkgs, ... }: {
certs = { config, ... }: {
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; };
shb.authelia = lib.mkOption { type = lib.types.anything; };
};
}
../../modules/blocks/nginx.nix
../../modules/blocks/ssl.nix
../../modules/services/grocy.nix
];
shb.certs = {
@ -94,7 +71,7 @@ in
certs.selfsigned = {
n = {
ca = config.shb.certs.cas.selfsigned.myca;
domain = "*.example.com";
domain = "*.${domain}";
group = "nginx";
};
};
@ -102,18 +79,54 @@ in
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;
domain = "example.com";
subdomain = "g";
inherit domain subdomain;
};
};
https = { config, ...}: {
shb.grocy = {
ssl = config.shb.certs.certs.selfsigned.n;
};
# Nginx port.
networking.firewall.allowedTCPPorts = [ 80 443 ];
shb.nginx.accessLog = true;
};
in
{
basic = pkgs.testers.runNixOSTest {
name = "grocy-basic";
nodes.server = lib.mkMerge [
base
basic
{
options = {
shb.authelia = lib.mkOption { type = lib.types.anything; };
};
}
];
nodes.client = {};
testScript = commonTestScript;
};
https = pkgs.testers.runNixOSTest {
name = "grocy-https";
nodes.server = lib.mkMerge [
base
certs
basic
https
{
options = {
shb.authelia = lib.mkOption { type = lib.types.anything; };
};
}
];
nodes.client = {};