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 port = 9090;
30 };
31 services.postgresql = {
32 enable = true;
33 ensureDatabases = [ "vikunja-api" ];
34 ensureUsers = [
35 { name = "vikunja-api";
36 ensurePermissions = { "DATABASE \"vikunja-api\"" = "ALL PRIVILEGES"; };
37 }
38 ];
39 };
40 services.nginx.enable = true;
41 };
42 };
43
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")
49
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")
54
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")
58
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 '';
64})