Fix TestRequestLogAPI
This commit is contained in:
parent
1971b07d39
commit
be05bfadec
@ -130,20 +130,19 @@ func TestRequestLogAPI(t *testing.T) {
|
|||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
data := tt.InitDefaultData(t, ws)
|
data := tt.InitDefaultData(t, ws)
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(900 * time.Millisecond)
|
||||||
|
|
||||||
ctx := ws.NewSimpleTransactionContext(5 * time.Second)
|
ctx := ws.NewSimpleTransactionContext(5 * time.Second)
|
||||||
defer ctx.Cancel()
|
defer ctx.Cancel()
|
||||||
|
|
||||||
rl1, _, err := ws.Database.Requests.ListRequestLogs(ctx, models.RequestLogFilter{}, nil, ct.Start())
|
rl1, _, err := ws.Database.Requests.ListRequestLogs(ctx, models.RequestLogFilter{}, nil, ct.Start())
|
||||||
tt.TestFailIfErr(t, err)
|
tt.TestFailIfErr(t, err)
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
|
|
||||||
tt.RequestAuthGet[gin.H](t, data.User[0].ReadKey, baseUrl, "/api/v2/users/"+data.User[0].UID)
|
tt.RequestAuthGet[gin.H](t, data.User[0].ReadKey, baseUrl, "/api/v2/users/"+data.User[0].UID)
|
||||||
|
time.Sleep(900 * time.Millisecond)
|
||||||
|
|
||||||
rl2, _, err := ws.Database.Requests.ListRequestLogs(ctx, models.RequestLogFilter{}, nil, ct.Start())
|
rl2, _, err := ws.Database.Requests.ListRequestLogs(ctx, models.RequestLogFilter{}, nil, ct.Start())
|
||||||
tt.TestFailIfErr(t, err)
|
tt.TestFailIfErr(t, err)
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
|
|
||||||
tt.AssertEqual(t, "requestlog.count", len(rl1)+1, len(rl2))
|
tt.AssertEqual(t, "requestlog.count", len(rl1)+1, len(rl2))
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ func TestResponseClient(t *testing.T) {
|
|||||||
|
|
||||||
data := tt.InitDefaultData(t, ws)
|
data := tt.InitDefaultData(t, ws)
|
||||||
|
|
||||||
response := tt.RequestAuthGetRaw(t, data.User[0].AdminKey, baseUrl, fmt.Sprintf("/api/v2/users/%s/clients/%s", data.User[0].UID, data.User[0].Clients[0]))
|
response := tt.RequestAuthGetRaw(t, data.User[0].AdminKey, baseUrl, fmt.Sprintf("/api/v2/users/%s/clients/%s", data.User[2].UID, data.User[2].Clients[2]))
|
||||||
|
|
||||||
tt.AssertJsonStructureMatch(t, "json[client]", response, map[string]any{})
|
tt.AssertJsonStructureMatch(t, "json[client]", response, map[string]any{})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user