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 carbon.enableCache = true;
16 seyren.enable = false; # Implicitly requires openssl-1.0.2u which is marked insecure
17 };
18 };
19 };
20
21 testScript = ''
22 start_all()
23 one.wait_for_unit("default.target")
24 one.wait_for_unit("graphiteWeb.service")
25 one.wait_for_unit("carbonCache.service")
26 # The services above are of type "simple". systemd considers them active immediately
27 # even if they're still in preStart (which takes quite long for graphiteWeb).
28 # Wait for ports to open so we're sure the services are up and listening.
29 one.wait_for_open_port(8080)
30 one.wait_for_open_port(2003)
31 one.succeed('echo "foo 1 `date +%s`" | nc -N localhost 2003')
32 one.wait_until_succeeds(
33 "curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2"
34 )
35 '';
36})