(t *testing.T)
| 552 | } |
| 553 | |
| 554 | func TestCompaction_populateBlock(t *testing.T) { |
| 555 | for _, tc := range []struct { |
| 556 | title string |
| 557 | inputSeriesSamples [][]seriesSamples |
| 558 | compactMinTime int64 |
| 559 | compactMaxTime int64 // When not defined the test runner sets a default of math.MaxInt64. |
| 560 | irPostingsFunc IndexReaderPostingsFunc |
| 561 | expSeriesSamples []seriesSamples |
| 562 | expErr error |
| 563 | }{ |
| 564 | { |
| 565 | title: "Populate block from empty input should return error.", |
| 566 | inputSeriesSamples: [][]seriesSamples{}, |
| 567 | expErr: errors.New("cannot populate block from no readers"), |
| 568 | }, |
| 569 | { |
| 570 | // Populate from single block without chunks. We expect these kind of series being ignored. |
| 571 | inputSeriesSamples: [][]seriesSamples{ |
| 572 | {{lset: map[string]string{"a": "b"}}}, |
| 573 | }, |
| 574 | }, |
| 575 | { |
| 576 | title: "Populate from single block. We expect the same samples at the output.", |
| 577 | inputSeriesSamples: [][]seriesSamples{ |
| 578 | { |
| 579 | { |
| 580 | lset: map[string]string{"a": "b"}, |
| 581 | chunks: [][]sample{{{t: 0}, {t: 10}}, {{t: 11}, {t: 20}}}, |
| 582 | }, |
| 583 | }, |
| 584 | }, |
| 585 | expSeriesSamples: []seriesSamples{ |
| 586 | { |
| 587 | lset: map[string]string{"a": "b"}, |
| 588 | chunks: [][]sample{{{t: 0}, {t: 10}}, {{t: 11}, {t: 20}}}, |
| 589 | }, |
| 590 | }, |
| 591 | }, |
| 592 | { |
| 593 | title: "Populate from two blocks.", |
| 594 | inputSeriesSamples: [][]seriesSamples{ |
| 595 | { |
| 596 | { |
| 597 | lset: map[string]string{"a": "b"}, |
| 598 | chunks: [][]sample{{{t: 0}, {t: 10}}, {{t: 11}, {t: 20}}}, |
| 599 | }, |
| 600 | { |
| 601 | lset: map[string]string{"a": "c"}, |
| 602 | chunks: [][]sample{{{t: 1}, {t: 9}}, {{t: 10}, {t: 19}}}, |
| 603 | }, |
| 604 | { |
| 605 | // no-chunk series should be dropped. |
| 606 | lset: map[string]string{"a": "empty"}, |
| 607 | }, |
| 608 | }, |
| 609 | { |
| 610 | { |
| 611 | lset: map[string]string{"a": "b"}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…