@@ -1,51 +0,0 @@
1−import ./make-test.nix ({ pkgs, lib, ... }:
2−
3−with lib;
4−
5−{
6− name = "statsd";
7− meta = with pkgs.stdenv.lib.maintainers; {
8− maintainers = [ ma27 ];
9− };
10−
11− machine = {
12− services.statsd.enable = true;
13− services.statsd.backends = [ "statsd-influxdb-backend" "console" ];
14− services.statsd.extraConfig = ''
15− influxdb: {
16− username: "root",
17− password: "root",
18− database: "statsd"
19− }
20− '';
21−
22− services.influxdb.enable = true;
23−
24− systemd.services.influx-init = {
25− description = "Setup Influx Test Base";
26− after = [ "influxdb.service" ];
27− before = [ "statsd.service" ];
28−
29− script = ''
30− echo "CREATE DATABASE statsd" | ${pkgs.influxdb}/bin/influx
31− '';
32− };
33− };
34−
35− testScript = ''
36− $machine->start();
37− $machine->waitForUnit("statsd.service");
38− $machine->waitForOpenPort(8126);
39−
40− # check state of the `statsd` server
41− $machine->succeed('[ "health: up" = "$(echo health | nc 127.0.0.1 8126 -w 120 -N)" ];');
42−
43− # confirm basic examples for metrics derived from docs:
44− # https://github.com/etsy/statsd/blob/v0.8.0/README.md#usage and
45− # https://github.com/etsy/statsd/blob/v0.8.0/docs/admin_interface.md
46− $machine->succeed("echo 'foo:1|c' | nc -u -w 0 127.0.0.1 8125");
47− $machine->succeed("echo counters | nc -w 120 127.0.0.1 8126 -N | grep foo");
48− $machine->succeed("echo 'delcounters foo' | nc -w 120 127.0.0.1 8126 -N");
49− $machine->fail("echo counters | nc -w 120 127.0.0.1 8126 -N | grep foo");
50− '';
51−})