diff options
author | Domen Kožar <domen@dev.si> | 2013-11-08 11:44:17 -0800 |
---|---|---|
committer | Domen Kožar <domen@dev.si> | 2013-11-08 11:44:17 -0800 |
commit | a623cc96e3a3045b21300583c1c8808c4cff38bc (patch) | |
tree | ef2d85d89b474ae734788509eccc06d965d27ffe /nixos/tests | |
parent | 3e8e635be7d3a1f93812b6692169bf9ca115be58 (diff) | |
parent | 8b1ab6d912b690329cff8a6ef0da2559488aeede (diff) | |
download | nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.tar nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.tar.gz nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.tar.bz2 nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.tar.lz nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.tar.xz nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.tar.zst nixlib-a623cc96e3a3045b21300583c1c8808c4cff38bc.zip |
Merge pull request #1066 from offlinehacker/nixos/logstash/update
nixos/logstash: update and simplify to be fully compatible with new version
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/default.nix | 1 | ||||
-rw-r--r-- | nixos/tests/logstash.nix | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/nixos/tests/default.nix b/nixos/tests/default.nix index ce5776c8e465..574e1dd2f8b8 100644 --- a/nixos/tests/default.nix +++ b/nixos/tests/default.nix @@ -16,6 +16,7 @@ with import ../lib/testing.nix { inherit system minimal; }; kde4 = makeTest (import ./kde4.nix); #kexec = makeTest (import ./kexec.nix); login = makeTest (import ./login.nix {}); + logstash = makeTest (import ./logstash.nix); latestKernel.login = makeTest (import ./login.nix ({ config, pkgs, ... }: { boot.kernelPackages = pkgs.linuxPackages_latest; })); misc = makeTest (import ./misc.nix); #mpich = makeTest (import ./mpich.nix); diff --git a/nixos/tests/logstash.nix b/nixos/tests/logstash.nix new file mode 100644 index 000000000000..ee309d39f872 --- /dev/null +++ b/nixos/tests/logstash.nix @@ -0,0 +1,40 @@ +{ pkgs, ... }: + +# This test runs logstash and checks if messages flows and elasticsearch is +# started + +{ + 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 = '' + if [type] == "test" { + grep { match => ["message", "flowers"] drop => true } + } + ''; + outputConfig = '' + stdout { codec => rubydebug } + elasticsearch { embedded => true } + ''; + }; + }; + }; + }; + + testScript = '' + startAll; + + $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"); + $one->waitUntilSucceeds("curl -s http://127.0.0.1:9200/_status?pretty=true | grep logstash"); + ''; +} |