@@ -561,150 +561,6 @@ func TestDedupSeriesSet(t *testing.T) {
561
561
}
562
562
}
563
563
564
- func TestDedupSeriesSet_Chain (t * testing.T ) {
565
- for _ , tcase := range []struct {
566
- name string
567
- input []series
568
- exp []series
569
- }{
570
- {
571
- name : "Single dedup label - exact match" ,
572
- input : []series {
573
- {
574
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
575
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
576
- },
577
- {
578
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
579
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
580
- },
581
- },
582
- exp : []series {
583
- {
584
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
585
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
586
- },
587
- },
588
- },
589
- {
590
- name : "Single dedup label - gap in one series" ,
591
- input : []series {
592
- {
593
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
594
- samples : []sample {{10000 , 1 }, {30000 , 3 }},
595
- },
596
- {
597
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
598
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
599
- },
600
- },
601
- exp : []series {
602
- {
603
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
604
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
605
- },
606
- },
607
- },
608
- {
609
- name : "Single dedup label - gaps in two series" ,
610
- input : []series {
611
- {
612
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
613
- samples : []sample {{10000 , 1 }, {30000 , 3 }},
614
- },
615
- {
616
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
617
- samples : []sample {{10000 , 1 }, {20000 , 2 }},
618
- },
619
- },
620
- exp : []series {
621
- {
622
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
623
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
624
- },
625
- },
626
- },
627
- {
628
- name : "Multi dedup label - exact match" ,
629
- input : []series {
630
- {
631
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
632
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
633
- },
634
- {
635
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
636
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
637
- },
638
- {
639
- lset : labels .FromStrings ("a" , "2" , "c" , "3" ),
640
- samples : []sample {{10000 , 101 }, {20000 , 102 }, {30000 , 103 }},
641
- },
642
- {
643
- lset : labels .FromStrings ("a" , "2" , "c" , "3" ),
644
- samples : []sample {{10000 , 101 }, {20000 , 102 }, {30000 , 103 }},
645
- },
646
- },
647
- exp : []series {
648
- {
649
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
650
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
651
- },
652
- {
653
- lset : labels .FromStrings ("a" , "2" , "c" , "3" ),
654
- samples : []sample {{10000 , 101 }, {20000 , 102 }, {30000 , 103 }},
655
- },
656
- },
657
- },
658
- {
659
- name : "Multi dedup label - gaps in two series" ,
660
- input : []series {
661
- {
662
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
663
- samples : []sample {{20000 , 2 }, {30000 , 3 }},
664
- },
665
- {
666
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
667
- samples : []sample {{10000 , 1 }, {20000 , 2 }},
668
- },
669
- {
670
- lset : labels .FromStrings ("a" , "2" , "c" , "3" ),
671
- samples : []sample {{10000 , 101 }, {20000 , 102 }},
672
- },
673
- {
674
- lset : labels .FromStrings ("a" , "2" , "c" , "3" ),
675
- samples : []sample {{10000 , 101 }, {30000 , 103 }},
676
- },
677
- },
678
- exp : []series {
679
- {
680
- lset : labels .FromStrings ("a" , "1" , "c" , "3" ),
681
- samples : []sample {{10000 , 1 }, {20000 , 2 }, {30000 , 3 }},
682
- },
683
- {
684
- lset : labels .FromStrings ("a" , "2" , "c" , "3" ),
685
- samples : []sample {{10000 , 101 }, {20000 , 102 }, {30000 , 103 }},
686
- },
687
- },
688
- },
689
- } {
690
- t .Run (tcase .name , func (t * testing.T ) {
691
- dedupSet := NewSeriesSet (& mockedSeriesSet {series : tcase .input }, "" , AlgorithmChain )
692
- var ats []storage.Series
693
- for dedupSet .Next () {
694
- ats = append (ats , dedupSet .At ())
695
- }
696
- testutil .Ok (t , dedupSet .Err ())
697
- testutil .Equals (t , len (tcase .exp ), len (ats ))
698
-
699
- for i , s := range ats {
700
- testutil .Equals (t , tcase .exp [i ].lset , s .Labels (), "labels mismatch for series %v" , i )
701
- res := expandSeries (t , s .Iterator (nil ))
702
- testutil .Equals (t , tcase .exp [i ].samples , res , "values mismatch for series :%v" , i )
703
- }
704
- })
705
- }
706
- }
707
-
708
564
func TestDedupSeriesIterator (t * testing.T ) {
709
565
// The deltas between timestamps should be at least 10000 to not be affected
710
566
// by the initial penalty of 5000, that will cause the second iterator to seek
0 commit comments