1import ./make-test-python.nix (
2 { pkgs, ... }:
3 let
4 port = "7745";
5 in
6 {
7 name = "homebox";
8 meta = with pkgs.lib.maintainers; {
9 maintainers = [ patrickdag ];
10 };
11 nodes =
12 let
13 self = {
14 simple = {
15 services.homebox = {
16 enable = true;
17 settings.HBOX_WEB_PORT = port;
18 };
19 };
20
21 postgres = {
22 imports = [ self.simple ];
23 services.homebox.database.createLocally = true;
24 };
25 };
26 in
27 self;
28 testScript = ''
29 def test_homebox(node):
30 node.wait_for_unit("homebox.service")
31 node.wait_for_open_port(${port})
32
33 node.succeed("curl --fail -X GET 'http://localhost:${port}/'")
34 out = node.succeed("curl --fail 'http://localhost:${port}/api/v1/status'")
35 assert '"health":true' in out
36
37 test_homebox(simple)
38 simple.send_monitor_command("quit")
39 simple.wait_for_shutdown()
40 test_homebox(postgres)
41 '';
42 }
43)