blob: 6fecd3d99fc4f9062f7fec281ff88a6975fbc39f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
{ pkgs, ... }:
{
name = "loki";
meta.maintainers = [ ];
nodes.machine =
{ ... }:
{
services.loki = {
enable = true;
configFile = "${pkgs.grafana-loki.src}/cmd/loki/loki-local-config.yaml";
};
};
testScript = ''
import json
import time
machine.start
machine.wait_for_unit("loki.service")
machine.wait_for_open_port(3100)
payload = json.dumps({
"streams": [{
"stream": {"job": "test"},
"values": [
[str(time.time_ns()), "Loki Ingestion Test"],
],
}],
})
machine.succeed(f"curl --json '{payload}' http://localhost:3100/loki/api/v1/push")
machine.wait_until_succeeds("logcli query --no-labels '{job=\"test\"}' | grep -q 'Loki Ingestion Test'")
'';
}
|