mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
fluentd: add simple test
This commit is contained in:
parent
66b551b088
commit
a5328e1386
2 changed files with 47 additions and 0 deletions
|
@ -85,6 +85,7 @@ in
|
||||||
flannel = handleTestOn ["x86_64-linux"] ./flannel.nix {};
|
flannel = handleTestOn ["x86_64-linux"] ./flannel.nix {};
|
||||||
flatpak = handleTest ./flatpak.nix {};
|
flatpak = handleTest ./flatpak.nix {};
|
||||||
flatpak-builder = handleTest ./flatpak-builder.nix {};
|
flatpak-builder = handleTest ./flatpak-builder.nix {};
|
||||||
|
fluentd = handleTest ./fluentd.nix {};
|
||||||
fsck = handleTest ./fsck.nix {};
|
fsck = handleTest ./fsck.nix {};
|
||||||
fwupd = handleTestOn ["x86_64-linux"] ./fwupd.nix {}; # libsmbios is unsupported on aarch64
|
fwupd = handleTestOn ["x86_64-linux"] ./fwupd.nix {}; # libsmbios is unsupported on aarch64
|
||||||
gdk-pixbuf = handleTest ./gdk-pixbuf.nix {};
|
gdk-pixbuf = handleTest ./gdk-pixbuf.nix {};
|
||||||
|
|
46
nixos/tests/fluentd.nix
Normal file
46
nixos/tests/fluentd.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import ./make-test.nix ({ pkgs, lib, ... }: {
|
||||||
|
name = "fluentd";
|
||||||
|
|
||||||
|
machine = { pkgs, ... }: {
|
||||||
|
services.fluentd = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
<source>
|
||||||
|
@type http
|
||||||
|
port 9880
|
||||||
|
</source>
|
||||||
|
|
||||||
|
<match **>
|
||||||
|
type copy
|
||||||
|
<store>
|
||||||
|
@type file
|
||||||
|
format json
|
||||||
|
path /tmp/fluentd
|
||||||
|
symlink_path /tmp/current-log
|
||||||
|
</store>
|
||||||
|
<store>
|
||||||
|
@type stdout
|
||||||
|
</store>
|
||||||
|
</match>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = let
|
||||||
|
testMessage = "an example log message";
|
||||||
|
|
||||||
|
payload = pkgs.writeText "test-message.json" (builtins.toJSON {
|
||||||
|
inherit testMessage;
|
||||||
|
});
|
||||||
|
in ''
|
||||||
|
$machine->start;
|
||||||
|
$machine->waitForUnit('fluentd.service');
|
||||||
|
$machine->waitForOpenPort(9880);
|
||||||
|
|
||||||
|
$machine->succeed("curl -fsSL -X POST -H 'Content-type: application/json' -d @${payload} http://localhost:9880/test.tag");
|
||||||
|
|
||||||
|
$machine->succeed("systemctl stop fluentd"); # blocking flush
|
||||||
|
|
||||||
|
$machine->succeed("grep '${testMessage}' /tmp/current-log");
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue