nixos/tests/loki: port to python

This commit is contained in:
WilliButz 2019-11-06 16:45:17 +01:00
parent 85f3d86bea
commit ff4e86f4a5
No known key found for this signature in database
GPG key ID: 92582A10F1179CB2

View file

@ -1,4 +1,4 @@
import ./make-test.nix ({ lib, pkgs, ... }:
import ./make-test-python.nix ({ lib, pkgs, ... }:
{
name = "loki";
@ -26,12 +26,14 @@ import ./make-test.nix ({ lib, pkgs, ... }:
};
testScript = ''
$machine->start;
$machine->waitForUnit("loki.service");
$machine->waitForUnit("promtail.service");
$machine->waitForOpenPort(3100);
$machine->waitForOpenPort(9080);
$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.start
machine.wait_for_unit("loki.service")
machine.wait_for_unit("promtail.service")
machine.wait_for_open_port(3100)
machine.wait_for_open_port(9080)
machine.succeed("echo 'Loki Ingestion Test' > /var/log/testlog")
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'"
)
'';
})