nixos/fluentd: port test to python

This commit is contained in:
Jan Hrnko 2019-11-09 19:45:52 +01:00 committed by Florian Klink
parent a0a07e3936
commit c999eab3e7

View file

@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, lib, ... }: { import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "fluentd"; name = "fluentd";
machine = { pkgs, ... }: { machine = { pkgs, ... }: {
@ -33,14 +33,17 @@ import ./make-test.nix ({ pkgs, lib, ... }: {
inherit testMessage; inherit testMessage;
}); });
in '' in ''
$machine->start; machine.start()
$machine->waitForUnit('fluentd.service'); machine.wait_for_unit("fluentd.service")
$machine->waitForOpenPort(9880); machine.wait_for_open_port(9880)
$machine->succeed("curl -fsSL -X POST -H 'Content-type: application/json' -d @${payload} http://localhost:9880/test.tag"); 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 # blocking flush
machine.succeed("systemctl stop fluentd")
$machine->succeed("grep '${testMessage}' /tmp/current-log"); machine.succeed("grep '${testMessage}' /tmp/current-log")
''; '';
}) })