mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
nixosTests.telegraf: switch to runTest
This commit is contained in:
parent
b27980ae20
commit
7435729ef7
2 changed files with 43 additions and 45 deletions
|
@ -1163,7 +1163,7 @@ in {
|
||||||
tayga = handleTest ./tayga.nix {};
|
tayga = handleTest ./tayga.nix {};
|
||||||
technitium-dns-server = handleTest ./technitium-dns-server.nix {};
|
technitium-dns-server = handleTest ./technitium-dns-server.nix {};
|
||||||
teeworlds = handleTest ./teeworlds.nix {};
|
teeworlds = handleTest ./teeworlds.nix {};
|
||||||
telegraf = handleTest ./telegraf.nix {};
|
telegraf = runTest ./telegraf.nix;
|
||||||
teleport = handleTest ./teleport.nix {};
|
teleport = handleTest ./teleport.nix {};
|
||||||
teleports = runTest ./teleports.nix;
|
teleports = runTest ./teleports.nix;
|
||||||
thelounge = handleTest ./thelounge.nix {};
|
thelounge = handleTest ./thelounge.nix {};
|
||||||
|
|
|
@ -1,47 +1,45 @@
|
||||||
import ./make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
name = "telegraf";
|
||||||
name = "telegraf";
|
meta = with pkgs.lib.maintainers; {
|
||||||
meta = with pkgs.lib.maintainers; {
|
maintainers = [ mic92 ];
|
||||||
maintainers = [ mic92 ];
|
};
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.telegraf.enable = true;
|
||||||
|
services.telegraf.environmentFiles = [
|
||||||
|
(pkgs.writeText "secrets" ''
|
||||||
|
SECRET=example
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
services.telegraf.extraConfig = {
|
||||||
|
agent.interval = "1s";
|
||||||
|
agent.flush_interval = "1s";
|
||||||
|
inputs.exec = {
|
||||||
|
commands = [
|
||||||
|
"${pkgs.runtimeShell} -c 'echo $SECRET,tag=a i=42i'"
|
||||||
|
];
|
||||||
|
timeout = "5s";
|
||||||
|
data_format = "influx";
|
||||||
|
};
|
||||||
|
inputs.ping = {
|
||||||
|
urls = [ "127.0.0.1" ];
|
||||||
|
count = 4;
|
||||||
|
interval = "10s";
|
||||||
|
timeout = 1.0;
|
||||||
|
};
|
||||||
|
outputs.file.files = [ "/tmp/metrics.out" ];
|
||||||
|
outputs.file.data_format = "influx";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.machine =
|
testScript = ''
|
||||||
{ ... }:
|
start_all()
|
||||||
{
|
|
||||||
services.telegraf.enable = true;
|
|
||||||
services.telegraf.environmentFiles = [
|
|
||||||
(pkgs.writeText "secrets" ''
|
|
||||||
SECRET=example
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
services.telegraf.extraConfig = {
|
|
||||||
agent.interval = "1s";
|
|
||||||
agent.flush_interval = "1s";
|
|
||||||
inputs.exec = {
|
|
||||||
commands = [
|
|
||||||
"${pkgs.runtimeShell} -c 'echo $SECRET,tag=a i=42i'"
|
|
||||||
];
|
|
||||||
timeout = "5s";
|
|
||||||
data_format = "influx";
|
|
||||||
};
|
|
||||||
inputs.ping = {
|
|
||||||
urls = [ "127.0.0.1" ];
|
|
||||||
count = 4;
|
|
||||||
interval = "10s";
|
|
||||||
timeout = 1.0;
|
|
||||||
};
|
|
||||||
outputs.file.files = [ "/tmp/metrics.out" ];
|
|
||||||
outputs.file.data_format = "influx";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
testScript = ''
|
machine.wait_for_unit("telegraf.service")
|
||||||
start_all()
|
machine.wait_until_succeeds("grep -q example /tmp/metrics.out")
|
||||||
|
machine.wait_until_succeeds("grep -q ping /tmp/metrics.out")
|
||||||
machine.wait_for_unit("telegraf.service")
|
'';
|
||||||
machine.wait_until_succeeds("grep -q example /tmp/metrics.out")
|
}
|
||||||
machine.wait_until_succeeds("grep -q ping /tmp/metrics.out")
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue