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

Function mockDistibutorFor

pkg/querier/querier_test.go:1318–1331  ·  view source on GitHub ↗

mockDistibutorFor duplicates the chunks in the mockChunkStore into the mockDistributor so we can test everything is dedupe correctly.

(t *testing.T, cks []chunk.Chunk)

Source from the content-addressed store, hash-verified

1316// mockDistibutorFor duplicates the chunks in the mockChunkStore into the mockDistributor
1317// so we can test everything is dedupe correctly.
1318func mockDistibutorFor(t *testing.T, cks []chunk.Chunk) *MockDistributor {
1319 //parallel testing causes data race
1320 chunks, err := chunkcompat.ToChunks(cks)
1321 require.NoError(t, err)
1322
1323 tsc := client.TimeSeriesChunk{
1324 Labels: []cortexpb.LabelAdapter{{Name: model.MetricNameLabel, Value: "foo"}},
1325 Chunks: chunks,
1326 }
1327
1328 result := &MockDistributor{}
1329 result.On("QueryStream", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&client.QueryStreamResponse{Chunkseries: []client.TimeSeriesChunk{tsc}}, nil)
1330 return result
1331}
1332
1333func testRangeQuery(t testing.TB, queryable storage.Queryable, queryEngine promql.QueryEngine, end model.Time, q query, enc promchunk.Encoding) *promql.Result {
1334 from, through, step := time.Unix(0, 0), end.Time(), q.step

Callers 2

TestQuerierFunction · 0.85
TestQuerierMetricFunction · 0.85

Calls 1

ToChunksFunction · 0.92

Tested by

no test coverage detected