Release NixOS 23.11
[NixPkgs.git] / nixos / tests / vikunja.nix
blob60fd5ce13854e357d1b10478660f08d83a6a45bc
1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
2   name = "vikunja";
4   meta.maintainers = with lib.maintainers; [ leona ];
6   nodes = {
7     vikunjaSqlite = { ... }: {
8       services.vikunja = {
9         enable = true;
10         database = {
11           type = "sqlite";
12         };
13         frontendScheme = "http";
14         frontendHostname = "localhost";
15       };
16       services.nginx.enable = true;
17     };
18     vikunjaPostgresql = { pkgs, ... }: {
19       services.vikunja = {
20         enable = true;
21         database = {
22           type = "postgres";
23           user = "vikunja-api";
24           database = "vikunja-api";
25           host = "/run/postgresql";
26         };
27         frontendScheme = "http";
28         frontendHostname = "localhost";
29         port = 9090;
30       };
31       services.postgresql = {
32         enable = true;
33         ensureDatabases = [ "vikunja-api" ];
34         ensureUsers = [
35           { name = "vikunja-api";
36             ensureDBOwnership = true;
37           }
38         ];
39       };
40       services.nginx.enable = true;
41     };
42   };
44   testScript =
45     ''
46       vikunjaSqlite.wait_for_unit("vikunja-api.service")
47       vikunjaSqlite.wait_for_open_port(3456)
48       vikunjaSqlite.succeed("curl --fail http://localhost:3456/api/v1/info")
50       vikunjaSqlite.wait_for_unit("nginx.service")
51       vikunjaSqlite.wait_for_open_port(80)
52       vikunjaSqlite.succeed("curl --fail http://localhost/api/v1/info")
53       vikunjaSqlite.succeed("curl --fail http://localhost")
55       vikunjaPostgresql.wait_for_unit("vikunja-api.service")
56       vikunjaPostgresql.wait_for_open_port(9090)
57       vikunjaPostgresql.succeed("curl --fail http://localhost:9090/api/v1/info")
59       vikunjaPostgresql.wait_for_unit("nginx.service")
60       vikunjaPostgresql.wait_for_open_port(80)
61       vikunjaPostgresql.succeed("curl --fail http://localhost/api/v1/info")
62       vikunjaPostgresql.succeed("curl --fail http://localhost")
63     '';