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