1import ./make-test-python.nix (
2 { pkgs, ... }:
3 let
4 testPort = 8108;
5 in
6 {
7 name = "typesense";
8 meta.maintainers = with pkgs.lib.maintainers; [ oddlama ];
9
10 nodes.machine =
11 { ... }:
12 {
13 services.typesense = {
14 enable = true;
15 apiKeyFile = pkgs.writeText "typesense-api-key" "dummy";
16 settings.server = {
17 api-port = testPort;
18 api-address = "0.0.0.0";
19 };
20 };
21 };
22
23 testScript = ''
24 machine.wait_for_unit("typesense.service")
25 machine.wait_for_open_port(${toString testPort})
26 # After waiting for the port, typesense still hasn't initialized the database, so wait until we can connect successfully
27 assert machine.wait_until_succeeds("curl --fail http://localhost:${toString testPort}/health") == '{"ok":true}'
28 '';
29 }
30)