mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 07:32:58 +00:00
services.statsd: add simple test
This commit is contained in:
parent
aaf1e1c4fb
commit
af75b48b51
@ -332,6 +332,7 @@ in rec {
|
||||
tests.slim = callTest tests/slim.nix {};
|
||||
tests.smokeping = callTest tests/smokeping.nix {};
|
||||
tests.snapper = callTest tests/snapper.nix {};
|
||||
tests.statsd = callTest tests/statsd.nix {};
|
||||
tests.switchTest = callTest tests/switch-test.nix {};
|
||||
tests.taskserver = callTest tests/taskserver.nix {};
|
||||
tests.tomcat = callTest tests/tomcat.nix {};
|
||||
|
40
nixos/tests/statsd.nix
Normal file
40
nixos/tests/statsd.nix
Normal file
@ -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");
|
||||
'';
|
||||
})
|
@ -68,8 +68,4 @@ nodePackages // {
|
||||
'';
|
||||
buildInputs = oldAttrs.buildInputs ++ [ pkgs.phantomjs2 ];
|
||||
});
|
||||
|
||||
# create an alias to ensure that Nix finds the appropriate package
|
||||
# by adopting the naming convention (statsd-`type`-backend) for statsd plugins.
|
||||
statsd-stackdriver-backend = nodePackages.stackdriver-statsd-backend;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user