nixos/tests/loki: port to python

This commit is contained in:
WilliButz
2019-11-07 11:30:01 +01:00
parent 85f3d86bea
commit ff4e86f4a5
+10 -8
View File
@@ -1,4 +1,4 @@
import ./make-test.nix ({ lib, pkgs, ... }: import ./make-test-python.nix ({ lib, pkgs, ... }:
{ {
name = "loki"; name = "loki";
@@ -26,12 +26,14 @@ import ./make-test.nix ({ lib, pkgs, ... }:
}; };
testScript = '' testScript = ''
$machine->start; machine.start
$machine->waitForUnit("loki.service"); machine.wait_for_unit("loki.service")
$machine->waitForUnit("promtail.service"); machine.wait_for_unit("promtail.service")
$machine->waitForOpenPort(3100); machine.wait_for_open_port(3100)
$machine->waitForOpenPort(9080); machine.wait_for_open_port(9080)
$machine->succeed("echo 'Loki Ingestion Test' > /var/log/testlog"); machine.succeed("echo 'Loki Ingestion Test' > /var/log/testlog")
$machine->waitUntilSucceeds("${pkgs.grafana-loki}/bin/logcli --addr='http://localhost:3100' query --no-labels '{job=\"varlogs\",filename=\"/var/log/testlog\"}' | grep -q 'Loki Ingestion Test'"); machine.wait_until_succeeds(
"${pkgs.grafana-loki}/bin/logcli --addr='http://localhost:3100' query --no-labels '{job=\"varlogs\",filename=\"/var/log/testlog\"}' | grep -q 'Loki Ingestion Test'"
)
''; '';
}) })