MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestUserStatsPageRendered

Function TestUserStatsPageRendered

pkg/ingester/http_admin_test.go:11–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestUserStatsPageRendered(t *testing.T) {
12 req := httptest.NewRequest(http.MethodGet, "/ingester/all_user_stats", nil)
13 res := httptest.NewRecorder()
14 userStats := []UserIDStats{
15 {
16 UserID: "123",
17 UserStats: UserStats{
18 IngestionRate: 11.11,
19 NumSeries: 2222,
20 APIIngestionRate: 33.33,
21 RuleIngestionRate: 44.44,
22 ActiveSeries: 5555,
23 LoadedBlocks: 6666,
24 },
25 },
26 }
27 AllUserStatsRender(res, req, userStats, 3, 3)
28 assert.Equal(t, http.StatusOK, res.Code)
29 body := res.Body.String()
30 assert.Regexp(t, "<td.+123.+/td>", body)
31 assert.Regexp(t, "<td.+11.11.+/td>", body)
32 assert.Regexp(t, "<td.+2222.+/td>", body)
33 assert.Regexp(t, "<td.+33.33.+/td>", body)
34 assert.Regexp(t, "<td.+44.44.+/td>", body)
35 assert.Regexp(t, "<td.+5555.+/td>", body)
36 assert.Regexp(t, "<td.+6666.+/td>", body)
37}

Callers

nothing calls this directly

Calls 3

AllUserStatsRenderFunction · 0.85
EqualMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected