(t *testing.T)
| 448 | } |
| 449 | |
| 450 | func TestSliceHistograms(t *testing.T) { |
| 451 | t.Parallel() |
| 452 | for _, tc := range []struct { |
| 453 | name string |
| 454 | histograms []SampleHistogramPair |
| 455 | minTs int64 |
| 456 | expectedHistograms []SampleHistogramPair |
| 457 | }{ |
| 458 | {name: "empty histograms"}, |
| 459 | { |
| 460 | name: "minTs smaller than first histogram's timestamp", |
| 461 | histograms: []SampleHistogramPair{ |
| 462 | { |
| 463 | TimestampMs: 1, |
| 464 | Histogram: testHistogram1, |
| 465 | }, |
| 466 | }, |
| 467 | minTs: 0, |
| 468 | expectedHistograms: []SampleHistogramPair{ |
| 469 | { |
| 470 | TimestampMs: 1, |
| 471 | Histogram: testHistogram1, |
| 472 | }, |
| 473 | }, |
| 474 | }, |
| 475 | { |
| 476 | name: "input histograms are not sorted, return all histograms", |
| 477 | histograms: []SampleHistogramPair{ |
| 478 | { |
| 479 | TimestampMs: 3, |
| 480 | Histogram: testHistogram1, |
| 481 | }, |
| 482 | { |
| 483 | TimestampMs: 1, |
| 484 | Histogram: testHistogram1, |
| 485 | }, |
| 486 | }, |
| 487 | minTs: 2, |
| 488 | expectedHistograms: []SampleHistogramPair{ |
| 489 | { |
| 490 | TimestampMs: 3, |
| 491 | Histogram: testHistogram1, |
| 492 | }, |
| 493 | { |
| 494 | TimestampMs: 1, |
| 495 | Histogram: testHistogram1, |
| 496 | }, |
| 497 | }, |
| 498 | }, |
| 499 | { |
| 500 | name: "minTs greater than the last histogram's timestamp", |
| 501 | histograms: []SampleHistogramPair{ |
| 502 | { |
| 503 | TimestampMs: 1, |
| 504 | Histogram: testHistogram1, |
| 505 | }, |
| 506 | { |
| 507 | TimestampMs: 2, |
nothing calls this directly
no test coverage detected