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