nixosTests.homepage-dashboard: add test for ping property on service
Use homepage's API to ensure that ping works
This commit is contained in:
@@ -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"
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user