nixosTest.homebox: test postgres provisioning

This commit is contained in:
Bruno BELANYI 2025-04-07 21:43:39 +01:00
parent 9c09962137
commit 52cb257ea6

View File

@ -8,19 +8,36 @@ import ./make-test-python.nix (
meta = with pkgs.lib.maintainers; { meta = with pkgs.lib.maintainers; {
maintainers = [ patrickdag ]; maintainers = [ patrickdag ];
}; };
nodes.machine = { nodes =
services.homebox = { let
enable = true; self = {
settings.HBOX_WEB_PORT = port; simple = {
}; services.homebox = {
}; enable = true;
testScript = '' settings.HBOX_WEB_PORT = port;
machine.wait_for_unit("homebox.service") };
machine.wait_for_open_port(${port}) };
machine.succeed("curl --fail -X GET 'http://localhost:${port}/'") postgres = {
out = machine.succeed("curl --fail 'http://localhost:${port}/api/v1/status'") imports = [ self.simple ];
assert '"health":true' in out services.homebox.database.createLocally = true;
};
};
in
self;
testScript = ''
def test_homebox(node):
node.wait_for_unit("homebox.service")
node.wait_for_open_port(${port})
node.succeed("curl --fail -X GET 'http://localhost:${port}/'")
out = node.succeed("curl --fail 'http://localhost:${port}/api/v1/status'")
assert '"health":true' in out
test_homebox(simple)
simple.send_monitor_command("quit")
simple.wait_for_shutdown()
test_homebox(postgres)
''; '';
} }
) )