python3Packages.xknx: 1.1.0 -> 1.2.0
[NixPkgs.git] / nixos / tests / vikunja.nix
blob2f6c4c1f46617d364b436007baac46caa91acaa0
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       };
30       services.postgresql = {
31         enable = true;
32         ensureDatabases = [ "vikunja-api" ];
33         ensureUsers = [
34           { name = "vikunja-api";
35             ensurePermissions = { "DATABASE \"vikunja-api\"" = "ALL PRIVILEGES"; };
36           }
37         ];
38       };
39       services.nginx.enable = true;
40     };
41   };
43   testScript =
44     ''
45       vikunjaSqlite.wait_for_unit("vikunja-api.service")
46       vikunjaSqlite.wait_for_open_port(3456)
47       vikunjaSqlite.succeed("curl --fail http://localhost:3456/api/v1/info")
49       vikunjaSqlite.wait_for_unit("nginx.service")
50       vikunjaSqlite.wait_for_open_port(80)
51       vikunjaSqlite.succeed("curl --fail http://localhost/api/v1/info")
52       vikunjaSqlite.succeed("curl --fail http://localhost")
54       vikunjaPostgresql.wait_for_unit("vikunja-api.service")
55       vikunjaPostgresql.wait_for_open_port(3456)
56       vikunjaPostgresql.succeed("curl --fail http://localhost:3456/api/v1/info")
58       vikunjaPostgresql.wait_for_unit("nginx.service")
59       vikunjaPostgresql.wait_for_open_port(80)
60       vikunjaPostgresql.succeed("curl --fail http://localhost/api/v1/info")
61       vikunjaPostgresql.succeed("curl --fail http://localhost")
62     '';