git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/telegraf: add test
commitecd1129dee9add903e3fdc50fb208374c1434e20 authorJörg Thalheim <joerg@thalheim.io> dateMon 21 Jan 2019, 11:30 (8 years ago) parent777b0f8
2 files changed+31
nixos/tests/all-tests.nix+1 nixos/tests/telegraf.nix+30
nixos/tests/all-tests.nix+1
@@ -200,6 +200,7 @@ in
200200 syncthing-relay = handleTest ./syncthing-relay.nix {};
201201 systemd = handleTest ./systemd.nix {};
202202 taskserver = handleTest ./taskserver.nix {};
203+ telegraf = handleTest ./telegraf.nix {};
203204 tomcat = handleTest ./tomcat.nix {};
204205 tor = handleTest ./tor.nix {};
205206 transmission = handleTest ./transmission.nix {};
nixos/tests/telegraf.nixnew file+30
@@ -0,0 +1,30 @@
1+import ./make-test.nix ({ pkgs, ...} : {
2+ name = "telegraf";
3+ meta = with pkgs.stdenv.lib.maintainers; {
4+ maintainers = [ mic92 ];
5+ };
6+
7+ machine = { ... }: {
8+ services.telegraf.enable = true;
9+ services.telegraf.extraConfig = {
10+ agent.interval = "1s";
11+ agent.flush_interval = "1s";
12+ inputs.exec = {
13+ commands = [
14+ "${pkgs.runtimeShell} -c 'echo example,tag=a i=42i'"
15+ ];
16+ timeout = "5s";
17+ data_format = "influx";
18+ };
19+ outputs.file.files = ["/tmp/metrics.out"];
20+ outputs.file.data_format = "influx";
21+ };
22+ };
23+
24+ testScript = ''
25+ startAll;
26+
27+ $machine->waitForUnit("telegraf.service");
28+ $machine->waitUntilSucceeds("grep -q example /tmp/metrics.out");
29+ '';
30+})