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