MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / TestLoki

Function TestLoki

log-driver/loki/loki_test.go:8–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestLoki(t *testing.T) {
9 d, err := NewDriver(`{"url":"http://localhost:3100","header":{"Content-Type":"application/json","X-Scope-OrgID":"tenant1"}}`)
10 if err != nil {
11 t.Fatalf("failed to create driver: %v", err)
12 }
13 logCountResult, err := d.LogCount("apinto", nil, 720, "strategy")
14 if err != nil {
15 t.Fatalf("failed to get log count: %v", err)
16 }
17 t.Log(logCountResult)
18 logs, count, err := d.Logs("apinto", map[string]string{"strategy": "03899736-5d79-4f26-bd6a-c312a5880780"}, time.Now().Add(-time.Hour*24), time.Now(), 1, 1)
19 if err != nil {
20 t.Fatalf("failed to get logs: %v", err)
21 }
22 t.Log(logs, count)
23 info, err := d.LogInfo("apinto", "c9f6b19c-7dfe-496b-9b39-4d049232fe95")
24 if err != nil {
25 t.Fatalf("failed to get log info: %v", err)
26 }
27 t.Log(info)
28}
29
30//func TestLokiLog(t *testing.T) {
31//

Callers

nothing calls this directly

Calls 4

LogCountMethod · 0.95
LogsMethod · 0.95
LogInfoMethod · 0.95
NewDriverFunction · 0.70

Tested by

no test coverage detected