vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / nixos / tests / vikunja.nix
blob4e2bf166a7b6cd74fbc7a9aea3eab7ec369cdd6c
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 = {
17         enable = true;
18         virtualHosts."http://localhost" = {
19           locations."/".proxyPass = "http://localhost:3456";
20         };
21       };
22     };
23     vikunjaPostgresql = { pkgs, ... }: {
24       services.vikunja = {
25         enable = true;
26         database = {
27           type = "postgres";
28           user = "vikunja";
29           database = "vikunja";
30           host = "/run/postgresql";
31         };
32         frontendScheme = "http";
33         frontendHostname = "localhost";
34         port = 9090;
35       };
36       services.postgresql = {
37         enable = true;
38         ensureDatabases = [ "vikunja" ];
39         ensureUsers = [
40           { name = "vikunja";
41             ensureDBOwnership = true;
42           }
43         ];
44       };
45       services.nginx = {
46         enable = true;
47         virtualHosts."http://localhost" = {
48           locations."/".proxyPass = "http://localhost:9090";
49         };
50       };
51     };
52   };
54   testScript =
55     ''
56       vikunjaSqlite.wait_for_unit("vikunja.service")
57       vikunjaSqlite.wait_for_open_port(3456)
58       vikunjaSqlite.succeed("curl --fail http://localhost:3456/api/v1/info")
60       vikunjaSqlite.wait_for_unit("nginx.service")
61       vikunjaSqlite.wait_for_open_port(80)
62       vikunjaSqlite.succeed("curl --fail http://localhost/api/v1/info")
63       vikunjaSqlite.succeed("curl --fail http://localhost")
65       vikunjaPostgresql.wait_for_unit("vikunja.service")
66       vikunjaPostgresql.wait_for_open_port(9090)
67       vikunjaPostgresql.succeed("curl --fail http://localhost:9090/api/v1/info")
69       vikunjaPostgresql.wait_for_unit("nginx.service")
70       vikunjaPostgresql.wait_for_open_port(80)
71       vikunjaPostgresql.succeed("curl --fail http://localhost/api/v1/info")
72       vikunjaPostgresql.succeed("curl --fail http://localhost")
73     '';