(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func 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 | } |
nothing calls this directly
no test coverage detected