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

Function verifyWriteRequestHandler

pkg/util/push/push_test.go:1122–1139  ·  view source on GitHub ↗
(t *testing.T, expectSource cortexpb.SourceEnum)

Source from the content-addressed store, hash-verified

1120}
1121
1122func verifyWriteRequestHandler(t *testing.T, expectSource cortexpb.SourceEnum) func(ctx context.Context, request *cortexpb.WriteRequest) (response *cortexpb.WriteResponse, err error) {
1123 t.Helper()
1124 return func(ctx context.Context, request *cortexpb.WriteRequest) (response *cortexpb.WriteResponse, err error) {
1125 assert.Len(t, request.Timeseries, 1)
1126 assert.Equal(t, "__name__", request.Timeseries[0].Labels[0].Name)
1127 assert.Equal(t, "foo", request.Timeseries[0].Labels[0].Value)
1128 assert.Equal(t, expectSource, request.Source)
1129 assert.False(t, request.SkipLabelNameValidation)
1130
1131 resp := &cortexpb.WriteResponse{
1132 Samples: 1,
1133 Histograms: 1,
1134 Exemplars: 1,
1135 }
1136
1137 return resp, nil
1138 }
1139}
1140
1141func createRequestWithHeaders(t *testing.T, headers map[string]string, protobuf []byte) *http.Request {
1142 t.Helper()

Calls 2

EqualMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected