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

Function TestHandler_cortexWriteRequest

pkg/util/push/push_test.go:1029–1053  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1027}
1028
1029func 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
1055func TestHandler_ignoresSkipLabelNameValidationIfSet(t *testing.T) {
1056 var limits validation.Limits

Callers

nothing calls this directly

Calls 10

DefaultValuesFunction · 0.92
NewOverridesFunction · 0.92
HandlerFunction · 0.70
createRequestFunction · 0.70
RunMethod · 0.65
EqualMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected