at 21.11-pre 1.6 kB view raw
1import ./make-test-python.nix ({ pkgs, ... } : 2{ 3 name = "graphite"; 4 nodes = { 5 one = 6 { ... }: { 7 virtualisation.memorySize = 1024; 8 time.timeZone = "UTC"; 9 services.graphite = { 10 web = { 11 enable = true; 12 extraConfig = '' 13 SECRET_KEY = "abcd"; 14 ''; 15 }; 16 api = { 17 enable = true; 18 port = 8082; 19 finders = [ ]; 20 }; 21 carbon.enableCache = true; 22 seyren.enable = false; # Implicitely requires openssl-1.0.2u which is marked insecure 23 beacon.enable = true; 24 }; 25 }; 26 }; 27 28 testScript = '' 29 start_all() 30 one.wait_for_unit("default.target") 31 one.wait_for_unit("graphiteWeb.service") 32 one.wait_for_unit("graphiteApi.service") 33 one.wait_for_unit("graphite-beacon.service") 34 one.wait_for_unit("carbonCache.service") 35 # The services above are of type "simple". systemd considers them active immediately 36 # even if they're still in preStart (which takes quite long for graphiteWeb). 37 # Wait for ports to open so we're sure the services are up and listening. 38 one.wait_for_open_port(8080) 39 one.wait_for_open_port(8082) 40 one.wait_for_open_port(2003) 41 one.succeed('echo "foo 1 `date +%s`" | nc -N localhost 2003') 42 one.wait_until_succeeds( 43 "curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2" 44 ) 45 one.wait_until_succeeds( 46 "curl 'http://localhost:8082/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2" 47 ) 48 ''; 49})