MCPcopy
hub / github.com/prometheus/prometheus / TestReadClient

Function TestReadClient

storage/remote/client_test.go:222–427  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

220}
221
222func TestReadClient(t *testing.T) {
223 tests := []struct {
224 name string
225 query *prompb.Query
226 httpHandler http.HandlerFunc
227 timeout time.Duration
228 expectedLabels []map[string]string
229 expectedSamples [][]model.SamplePair
230 expectedErrorContains string
231 sortSeries bool
232 unwrap bool
233 }{
234 {
235 name: "sorted sampled response",
236 httpHandler: sampledResponseHTTPHandler(t),
237 expectedLabels: []map[string]string{
238 {"foo1": "bar"},
239 {"foo2": "bar"},
240 },
241 expectedSamples: [][]model.SamplePair{
242 {
243 {Timestamp: model.Time(0), Value: model.SampleValue(3)},
244 {Timestamp: model.Time(5), Value: model.SampleValue(4)},
245 },
246 {
247 {Timestamp: model.Time(0), Value: model.SampleValue(1)},
248 {Timestamp: model.Time(5), Value: model.SampleValue(2)},
249 },
250 },
251 expectedErrorContains: "",
252 sortSeries: true,
253 },
254 {
255 name: "unsorted sampled response",
256 httpHandler: sampledResponseHTTPHandler(t),
257 expectedLabels: []map[string]string{
258 {"foo2": "bar"},
259 {"foo1": "bar"},
260 },
261 expectedSamples: [][]model.SamplePair{
262 {
263 {Timestamp: model.Time(0), Value: model.SampleValue(1)},
264 {Timestamp: model.Time(5), Value: model.SampleValue(2)},
265 },
266 {
267 {Timestamp: model.Time(0), Value: model.SampleValue(3)},
268 {Timestamp: model.Time(5), Value: model.SampleValue(4)},
269 },
270 },
271 expectedErrorContains: "",
272 sortSeries: false,
273 },
274 {
275 name: "chunked response",
276 query: &prompb.Query{
277 StartTimestampMs: 4000,
278 EndTimestampMs: 12000,
279 },

Callers

nothing calls this directly

Calls 15

WriteMethod · 0.95
ReadMethod · 0.95
NewChunkedWriterFunction · 0.85
buildTestChunksFunction · 0.85
NewReadClientFunction · 0.85
HeaderMethod · 0.80
DurationMethod · 0.80
SetMethod · 0.65
ErrorMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…