MCPcopy Create free account
hub / github.com/cortexproject/cortex / createCortexWriteRequestProtobuf

Function createCortexWriteRequestProtobuf

pkg/util/push/push_test.go:1233–1253  ·  view source on GitHub ↗
(t *testing.T, skipLabelNameValidation bool, source cortexpb.SourceEnum)

Source from the content-addressed store, hash-verified

1231 return inoutBytes
1232}
1233func createCortexWriteRequestProtobuf(t *testing.T, skipLabelNameValidation bool, source cortexpb.SourceEnum) []byte {
1234 t.Helper()
1235 ts := cortexpb.PreallocTimeseries{
1236 TimeSeries: &cortexpb.TimeSeries{
1237 Labels: []cortexpb.LabelAdapter{
1238 {Name: "__name__", Value: "foo"},
1239 },
1240 Samples: []cortexpb.Sample{
1241 {Value: 1, TimestampMs: time.Date(2020, 4, 1, 0, 0, 0, 0, time.UTC).UnixNano()},
1242 },
1243 },
1244 }
1245 input := cortexpb.WriteRequest{
1246 Timeseries: []cortexpb.PreallocTimeseries{ts},
1247 Source: source,
1248 SkipLabelNameValidation: skipLabelNameValidation,
1249 }
1250 inoutBytes, err := input.Marshal()
1251 require.NoError(t, err)
1252 return inoutBytes
1253}
1254
1255// TestHandler_RemoteWriteV2_MetadataPoolReset verifies that reusing a WriteRequestV2
1256// from the sync.Pool does not carry over omitted Metadata fields (UnitRef and HelpRef),

Calls 1

MarshalMethod · 0.95

Tested by

no test coverage detected