From af75b48b518a0d897693dafefbb3c02eaf3215cc Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 26 Nov 2017 01:15:10 +0100 Subject: services.statsd: add simple test --- nixos/tests/statsd.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 nixos/tests/statsd.nix (limited to 'nixos/tests') diff --git a/nixos/tests/statsd.nix b/nixos/tests/statsd.nix new file mode 100644 index 000000000000..d6bbc3901630 --- /dev/null +++ b/nixos/tests/statsd.nix @@ -0,0 +1,40 @@ +import ./make-test.nix ({ pkgs, lib }: + +with lib; + +{ + name = "statsd"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ ma27 ]; + }; + + nodes.statsd1 = { + services.statsd.enable = true; + services.statsd.backends = [ "statsd-influxdb-backend" "console" ]; + services.statsd.extraConfig = '' + influxdb: { + username: "root", + password: "root", + database: "statsd" + } + ''; + + services.influxdb.enable = true; + + systemd.services.influx-init = { + description = "Setup Influx Test Base"; + after = [ "influxdb.service" ]; + before = [ "statsd.service" ]; + + script = '' + echo "CREATE DATABASE statsd" | ${pkgs.influxdb}/bin/influx + ''; + }; + }; + + testScript = '' + $statsd1->start(); + $statsd1->waitForUnit("statsd.service"); + $statsd1->succeed("nc -z 127.0.0.1 8126"); + ''; +}) -- cgit 1.4.1