From 74411c6c0d5ef37c3c93dea06e24d92c0f204415 Mon Sep 17 00:00:00 2001 From: Parthiv Krishna Date: Wed, 17 Sep 2025 08:20:45 +0000 Subject: [PATCH] nixosTests.homepage-dashboard: add test for ping property on service Use homepage's API to ensure that ping works --- nixos/tests/homepage-dashboard.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nixos/tests/homepage-dashboard.nix b/nixos/tests/homepage-dashboard.nix index 53e5b113cd02..d72ebc215295 100644 --- a/nixos/tests/homepage-dashboard.nix +++ b/nixos/tests/homepage-dashboard.nix @@ -21,10 +21,23 @@ ]; } ]; + services = [ + { + Machines = [ + { + Localhost = { + ping = "127.0.0.1"; + }; + } + ]; + } + ]; }; }; testScript = '' + import json + # Ensure the services are started on managed machine machine.wait_for_unit("homepage-dashboard.service") machine.wait_for_open_port(8082) @@ -40,5 +53,9 @@ # Ensure that we see the custom bookmarks on the page page = machine.succeed("curl --fail http://127.0.0.1:8082/api/bookmarks") assert "nixpkgs" in page, "Custom bookmarks not found" + + # Ensure that the ping command works + response = machine.succeed("curl --fail \"http://localhost:8082/api/ping?groupName=Machines&serviceName=Localhost\"") + assert json.loads(response)["alive"] is True, "Ping to localhost failed" ''; }