1 import ./make-test-python.nix ({ lib, pkgs, ... }:
6 meta = with lib.maintainers; {
7 maintainers = [ willibutz ];
10 nodes.machine = { ... }: {
13 configFile = "${pkgs.grafana-loki.src}/cmd/loki/loki-local-config.yaml";
19 http_listen_port = 9080;
22 clients = [ { url = "http://localhost:3100/loki/api/v1/push"; } ];
28 targets = [ "localhost" ];
31 __path__ = "/var/log/*log";
43 machine.wait_for_unit("loki.service")
44 machine.wait_for_unit("promtail.service")
45 machine.wait_for_open_port(3100)
46 machine.wait_for_open_port(9080)
47 machine.succeed("echo 'Loki Ingestion Test' > /var/log/testlog")
48 # should not have access to journal unless specified
50 "systemctl show --property=SupplementaryGroups promtail | grep -q systemd-journal"
52 machine.wait_until_succeeds(
53 "${pkgs.grafana-loki}/bin/logcli --addr='http://localhost:3100' query --no-labels '{job=\"varlogs\",filename=\"/var/log/testlog\"}' | grep -q 'Loki Ingestion Test'"