(t *testing.T)
| 1027 | } |
| 1028 | |
| 1029 | func TestHandler_cortexWriteRequest(t *testing.T) { |
| 1030 | var limits validation.Limits |
| 1031 | flagext.DefaultValues(&limits) |
| 1032 | overrides := validation.NewOverrides(limits, nil) |
| 1033 | |
| 1034 | sourceIPs, _ := middleware.NewSourceIPs("SomeField", "(.*)") |
| 1035 | handler := Handler(true, false, 100000, overrides, sourceIPs, verifyWriteRequestHandler(t, cortexpb.API), nil) |
| 1036 | |
| 1037 | t.Run("remote write v1", func(t *testing.T) { |
| 1038 | req := createRequest(t, createCortexWriteRequestProtobuf(t, false, cortexpb.API), false) |
| 1039 | resp := httptest.NewRecorder() |
| 1040 | handler.ServeHTTP(resp, req) |
| 1041 | assert.Equal(t, 200, resp.Code) |
| 1042 | }) |
| 1043 | t.Run("remote write v2", func(t *testing.T) { |
| 1044 | ctx := context.Background() |
| 1045 | ctx = user.InjectOrgID(ctx, "user-1") |
| 1046 | |
| 1047 | req := createRequest(t, createCortexRemoteWriteV2Protobuf(t, false, cortexpb.API), true) |
| 1048 | req = req.WithContext(ctx) |
| 1049 | resp := httptest.NewRecorder() |
| 1050 | handler.ServeHTTP(resp, req) |
| 1051 | assert.Equal(t, http.StatusNoContent, resp.Code) |
| 1052 | }) |
| 1053 | } |
| 1054 | |
| 1055 | func TestHandler_ignoresSkipLabelNameValidationIfSet(t *testing.T) { |
| 1056 | var limits validation.Limits |
nothing calls this directly
no test coverage detected