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