1 import ../make-test-python.nix ({ lib, pkgs, ... }: {
4 meta = with lib.maintainers; {
5 maintainers = [ phaer ];
8 nodes.machine = { ... }: {
9 services.healthchecks = {
12 SITE_NAME = "MyUniqueInstance";
13 COMPRESS_ENABLED = "True";
14 SECRET_KEY_FILE = pkgs.writeText "secret"
15 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
22 machine.wait_for_unit("healthchecks.target")
23 machine.wait_until_succeeds("journalctl --since -1m --unit healthchecks --grep Listening")
25 with subtest("Home screen loads"):
27 "curl -sSfL http://localhost:8000 | grep '<title>Sign In'"
30 with subtest("Setting SITE_NAME via freeform option works"):
32 "curl -sSfL http://localhost:8000 | grep 'MyUniqueInstance</title>'"
35 with subtest("Manage script works"):
36 # "shell" sucommand should succeed, needs python in PATH.
37 assert "foo\n" == machine.succeed("echo 'print(\"foo\")' | sudo -u healthchecks healthchecks-manage shell")
39 # Shouldn't fail if not called by healthchecks user
40 assert "foo\n" == machine.succeed("echo 'print(\"foo\")' | healthchecks-manage shell")