(t *testing.T)
| 220 | } |
| 221 | |
| 222 | func 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 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…