vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / gancio.nix
blob8f4696d6f6cc4e9d6cf19b3869626a1c0966aee0
1 import ./make-test-python.nix (
2   { pkgs, ... }:
3   let
4     extraHosts = ''
5       192.168.13.12 agenda.example.com
6     '';
7   in
8   {
9     name = "gancio";
10     meta.maintainers = with pkgs.lib.maintainers; [ jbgi ];
12     nodes = {
13       server =
14         { pkgs, ... }:
15         {
16           networking = {
17             interfaces.eth1 = {
18               ipv4.addresses = [
19                 {
20                   address = "192.168.13.12";
21                   prefixLength = 24;
22                 }
23               ];
24             };
25             inherit extraHosts;
26             firewall.allowedTCPPorts = [ 80 ];
27           };
28           environment.systemPackages = [ pkgs.gancio ];
29           services.gancio = {
30             enable = true;
31             settings = {
32               hostname = "agenda.example.com";
33               db.dialect = "postgres";
34             };
35             plugins = [ pkgs.gancioPlugins.telegram-bridge ];
36             userLocale = {
37               en = {
38                 register = {
39                   description = "My new registration page description";
40                 };
41               };
42             };
43             nginx = {
44               enableACME = false;
45               forceSSL = false;
46             };
47           };
48         };
50       client =
51         { pkgs, ... }:
52         {
53           environment.systemPackages = [ pkgs.jq ];
54           networking = {
55             interfaces.eth1 = {
56               ipv4.addresses = [
57                 {
58                   address = "192.168.13.1";
59                   prefixLength = 24;
60                 }
61               ];
62             };
63             inherit extraHosts;
64           };
65         };
66     };
68     testScript = ''
69       start_all()
71       server.wait_for_unit("postgresql")
72       server.wait_for_unit("gancio")
73       server.wait_for_unit("nginx")
74       server.wait_for_file("/run/gancio/socket")
75       server.wait_for_open_port(80)
77       # Check can create user via cli
78       server.succeed("cd /var/lib/gancio && sudo -u gancio gancio users create admin dummy admin")
80       # Check event list is returned
81       client.wait_until_succeeds("curl --verbose --fail-with-body http://agenda.example.com/api/events", timeout=30)
83       server.shutdown()
84       client.shutdown()
85     '';
86   }