1import ./make-test-python.nix ({ pkgs, lib, ... }: {
2 name = "vikunja";
3
4 meta.maintainers = with lib.maintainers; [ leona ];
5
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 };
42
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")
48
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")
53
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")
57
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 '';
63})