1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/nixos/tests/logstash.nix

42 lines
1.1 KiB
Nix
Raw Normal View History

# This test runs logstash and checks if messages flows and
# elasticsearch is started.
2013-11-01 13:09:17 +00:00
import ./make-test.nix ({ pkgs, ...} : {
2014-06-28 15:04:49 +01:00
name = "logstash";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ eelco chaoflow offline ];
};
2013-11-01 13:09:17 +00:00
nodes = {
one =
{ config, pkgs, ... }:
{
services = {
logstash = {
enable = true;
inputConfig = ''
exec { command => "echo flowers" interval => 1 type => "test" }
exec { command => "echo dragons" interval => 1 type => "test" }
'';
filterConfig = ''
2015-09-06 14:19:52 +01:00
if [message] =~ /dragons/ {
drop {}
2013-11-01 13:09:17 +00:00
}
'';
outputConfig = ''
stdout { codec => rubydebug }
'';
};
};
};
};
2013-11-01 13:09:17 +00:00
testScript = ''
startAll;
2013-11-01 13:09:17 +00:00
$one->waitForUnit("logstash.service");
$one->waitUntilSucceeds("journalctl -n 20 _SYSTEMD_UNIT=logstash.service | grep flowers");
$one->fail("journalctl -n 20 _SYSTEMD_UNIT=logstash.service | grep dragons");
'';
})