From a9085572f2a0d645b20a404262554991405119fa Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Fri, 21 Mar 2025 13:41:11 +0800 Subject: [PATCH] nixosTests.scrutiny: add test for notification feature --- nixos/tests/scrutiny.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/nixos/tests/scrutiny.nix b/nixos/tests/scrutiny.nix index a81dd60d8518..93a28c861dcf 100644 --- a/nixos/tests/scrutiny.nix +++ b/nixos/tests/scrutiny.nix @@ -15,7 +15,18 @@ import ./make-test-python.nix ( }: { services = { - scrutiny.enable = true; + scrutiny = { + enable = true; + settings = { + notify.urls = [ + { + _secret = pkgs.writeText "notify-script" "script://${pkgs.writeShellScript "touch-test-file" '' + echo "HelloWorld" > /run/scrutiny/hello + ''}"; + } + ]; + }; + }; scrutiny.collector.enable = true; }; @@ -78,6 +89,12 @@ import ./make-test-python.nix ( # Ensure the application is actually rendered by the Javascript machine.succeed("PYTHONUNBUFFERED=1 selenium-script") + + # Test notification and genJqSecretsReplacementSnippet + machine.succeed("curl -X POST http://localhost:8080/api/health/notify") + machine.wait_for_file("/run/scrutiny/hello") + output = machine.succeed("cat /run/scrutiny/hello") + assert "HelloWorld" in output ''; } )