1import ./make-test.nix ({ pkgs, lib, ... }:
2
3with lib;
4
5{
6 name = "statsd";
7 meta = with pkgs.stdenv.lib.maintainers; {
8 maintainers = [ ma27 ];
9 };
10
11 nodes.statsd1 = {
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 $statsd1->start();
37 $statsd1->waitForUnit("statsd.service");
38 $statsd1->succeed("nc -z 127.0.0.1 8126");
39 '';
40})