From 52cb257ea6b3da911b134143117d9c7480c4a312 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 7 Apr 2025 21:43:39 +0100 Subject: [PATCH] nixosTest.homebox: test postgres provisioning --- nixos/tests/homebox.nix | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/nixos/tests/homebox.nix b/nixos/tests/homebox.nix index 2d14a153c976..aadcd4269774 100644 --- a/nixos/tests/homebox.nix +++ b/nixos/tests/homebox.nix @@ -8,19 +8,36 @@ import ./make-test-python.nix ( meta = with pkgs.lib.maintainers; { maintainers = [ patrickdag ]; }; - nodes.machine = { - services.homebox = { - enable = true; - settings.HBOX_WEB_PORT = port; - }; - }; - testScript = '' - machine.wait_for_unit("homebox.service") - machine.wait_for_open_port(${port}) + nodes = + let + self = { + simple = { + services.homebox = { + enable = true; + settings.HBOX_WEB_PORT = port; + }; + }; - machine.succeed("curl --fail -X GET 'http://localhost:${port}/'") - out = machine.succeed("curl --fail 'http://localhost:${port}/api/v1/status'") - assert '"health":true' in out + postgres = { + imports = [ self.simple ]; + 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) ''; } )