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