add some more smoke tests.

This commit is contained in:
Ingolf Wagner 2024-09-15 09:11:25 +07:00
parent 743a9fc885
commit d0a34454d4
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
2 changed files with 20 additions and 2 deletions

View file

@ -172,7 +172,7 @@
++ [ ++ [
./machines/${name}/configuration.nix ./machines/${name}/configuration.nix
nix-topology.nixosModules.default nix-topology.nixosModules.default
#self.nixosModules.verify self.nixosModules.verify
]; ];
}; };
@ -462,7 +462,6 @@
srvos.nixosModules.hardware-hetzner-online-intel srvos.nixosModules.hardware-hetzner-online-intel
#srvos.nixosModules.server #srvos.nixosModules.server
#srvos.nixosModules.mixins-terminfo #srvos.nixosModules.mixins-terminfo
self.nixosModules.verify
{ {
home-manager.users.mainUser = import ./homes/palo; home-manager.users.mainUser = import ./homes/palo;
home-manager.users.root = import ./homes/root; home-manager.users.root = import ./homes/root;

View file

@ -1,6 +1,7 @@
{ {
config, config,
pkgs, pkgs,
lib,
nixos-artwork, nixos-artwork,
... ...
}: }:
@ -29,6 +30,24 @@
}; };
networking.firewall.interfaces.wg0.allowedTCPPorts = [ config.services.paperless.port ]; networking.firewall.interfaces.wg0.allowedTCPPorts = [ config.services.paperless.port ];
verify.localCommands.paperless =
let
domain = "http://paperless.ingolf-wagner.de/accounts/login/?next=/";
curl = lib.getExe pkgs.curl;
grep = lib.getExe pkgs.gnugrep;
grepString = "paperless.chungus.private";
in
''
if ${curl} -s -o /dev/null -w "%{http_code}" ${domain} | ${grep} -q "200"; then
if ${curl} -s ${domain} | ${grep} -q "${grepString}"; then
echo "[ OK ] Die Seite hat Statuscode 200 und enthält den String '${grepString}'."
else
echo "[Fail] Der Statuscode ist 200, aber die Seite enthält den String '${grepString}' nicht."
fi
else
echo "[Fail] Die Seite hat keinen Statuscode 200."
fi
'';
services.nginx.virtualHosts."paperless.${config.networking.hostName}.private" = { services.nginx.virtualHosts."paperless.${config.networking.hostName}.private" = {
serverAliases = [ "paperless.ingolf-wagner.de" ]; serverAliases = [ "paperless.ingolf-wagner.de" ];