1 import ./make-test-python.nix ({ pkgs, ... }:
4 meta.maintainers = with pkgs.lib.maintainers; [ marie ];
11 { address = "192.168.2.10"; prefixLength = 24; }
14 firewall.allowedTCPPorts = [ 31638 ];
17 services.redis.servers.db-rest = {
20 requirePass = "choochoo";
25 serverWithTcp = { pkgs, ... }: {
28 "db-rest/password-redis-db".text = ''
37 { address = "192.168.2.11"; prefixLength = 24; }
40 firewall.allowedTCPPorts = [ 3000 ];
48 createLocally = false;
49 host = "192.168.2.10";
51 passwordFile = "/etc/db-rest/password-redis-db";
57 serverWithUnixSocket = { pkgs, ... }: {
61 { address = "192.168.2.12"; prefixLength = 24; }
64 firewall.allowedTCPPorts = [ 3000 ];
78 environment.systemPackages = [ pkgs.jq ];
82 { address = "192.168.2.13"; prefixLength = 24; }
92 with subtest("db-rest redis with TCP socket"):
93 database.wait_for_unit("redis-db-rest.service")
94 database.wait_for_open_port(31638)
96 serverWithTcp.wait_for_unit("db-rest.service")
97 serverWithTcp.wait_for_open_port(3000)
99 client.succeed("curl --fail --get http://192.168.2.11:3000/stations --data-urlencode 'query=Köln Hbf' | jq -r '.\"8000207\".name' | grep 'Köln Hbf'")
101 with subtest("db-rest redis with Unix socket"):
102 serverWithUnixSocket.wait_for_unit("db-rest.service")
103 serverWithUnixSocket.wait_for_open_port(3000)
105 client.succeed("curl --fail --get http://192.168.2.12:3000/stations --data-urlencode 'query=Köln Hbf' | jq -r '.\"8000207\".name' | grep 'Köln Hbf'")