From ea4107aba089d07208e97390c478496e60ed2787 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 15 Jun 2024 15:25:40 +0200 Subject: [PATCH] nixosTest.homebox: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/homebox.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 nixos/tests/homebox.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 8286164aea9b..d63e33ce9a60 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -420,6 +420,7 @@ in { hddfancontrol = handleTest ./hddfancontrol.nix {}; hedgedoc = handleTest ./hedgedoc.nix {}; herbstluftwm = handleTest ./herbstluftwm.nix {}; + homebox = handleTest ./homebox.nix {}; homepage-dashboard = handleTest ./homepage-dashboard.nix {}; honk = runTest ./honk.nix; installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {}); diff --git a/nixos/tests/homebox.nix b/nixos/tests/homebox.nix new file mode 100644 index 000000000000..2d14a153c976 --- /dev/null +++ b/nixos/tests/homebox.nix @@ -0,0 +1,26 @@ +import ./make-test-python.nix ( + { pkgs, ... }: + let + port = "7745"; + in + { + name = "homebox"; + 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}) + + 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 + ''; + } +)