@@ -565,94 +565,28 @@ func TestGetBackupTreeIndexMetadata(t *testing.T) {
565
565
testcases := []struct {
566
566
name string
567
567
chain chain
568
- // endTime filter. Set to 0 for no filter.
569
- endTime int
570
- error string
568
+ error string
571
569
// expectedIndexTimes should be sorted in ascending order by end time, with
572
570
// ties broken by ascending start time.
573
571
expectedIndexTimes chain
574
572
}{
575
573
{
576
- name : "fetch all indexes from subdir " ,
574
+ name : "fetch all indexes from chain with no compacted backups " ,
577
575
chain : simpleChain ,
578
576
expectedIndexTimes : [][2 ]int {{0 , 2 }, {2 , 4 }, {4 , 6 }, {6 , 8 }},
579
577
},
580
- {
581
- name : "exact end time match" ,
582
- chain : simpleChain ,
583
- endTime : 6 ,
584
- expectedIndexTimes : [][2 ]int {{0 , 2 }, {2 , 4 }, {4 , 6 }},
585
- },
586
- {
587
- name : "end time between an incremental" ,
588
- chain : simpleChain ,
589
- endTime : 5 ,
590
- expectedIndexTimes : [][2 ]int {{0 , 2 }, {2 , 4 }, {4 , 6 }},
591
- },
592
- {
593
- name : "end time before full backup end" ,
594
- chain : simpleChain ,
595
- endTime : 1 ,
596
- expectedIndexTimes : chain {{0 , 2 }},
597
- },
598
- {
599
- name : "end time after the chain" ,
600
- chain : simpleChain ,
601
- endTime : 10 ,
602
- error : "do not cover end time" ,
603
- },
604
578
{
605
579
name : "fetch all indexes from tree with compacted backups" ,
606
580
chain : compactedChain ,
607
581
expectedIndexTimes : chain {{0 , 10 }, {10 , 11 }, {10 , 12 }, {11 , 12 }, {12 , 14 }, {14 , 16 }},
608
582
},
609
- {
610
- name : "end time of compacted backup" ,
611
- chain : compactedChain ,
612
- endTime : 12 ,
613
- expectedIndexTimes : chain {{0 , 10 }, {10 , 11 }, {10 , 12 }, {11 , 12 }},
614
- },
615
- {
616
- name : "end time between incremental after compacted backup" ,
617
- chain : compactedChain ,
618
- endTime : 13 ,
619
- expectedIndexTimes : chain {{0 , 10 }, {10 , 11 }, {10 , 12 }, {11 , 12 }, {12 , 14 }},
620
- },
621
- {
622
- name : "end time between compacted backup" ,
623
- chain : compactedChain ,
624
- endTime : 11 ,
625
- expectedIndexTimes : chain {{0 , 10 }, {10 , 11 }},
626
- },
627
- {
628
- name : "end time before compacted backup" ,
629
- chain : compactedChain ,
630
- endTime : 11 ,
631
- expectedIndexTimes : chain {{0 , 10 }, {10 , 11 }},
632
- },
633
583
{
634
584
name : "fetch all indexes from tree with double compacted backups" ,
635
585
chain : doubleCompactedChain ,
636
586
expectedIndexTimes : chain {
637
587
{0 , 18 }, {18 , 20 }, {18 , 22 }, {20 , 22 }, {22 , 24 }, {18 , 26 }, {24 , 26 },
638
588
},
639
589
},
640
- {
641
- name : "end time before second compacted backup but after first" ,
642
- chain : doubleCompactedChain ,
643
- endTime : 24 ,
644
- expectedIndexTimes : chain {
645
- {0 , 18 }, {18 , 20 }, {18 , 22 }, {20 , 22 }, {22 , 24 },
646
- },
647
- },
648
- {
649
- name : "end time of second compacted backup" ,
650
- chain : doubleCompactedChain ,
651
- endTime : 26 ,
652
- expectedIndexTimes : chain {
653
- {0 , 18 }, {18 , 20 }, {18 , 22 }, {20 , 22 }, {22 , 24 }, {18 , 26 }, {24 , 26 },
654
- },
655
- },
656
590
{
657
591
name : "index only contains a full backup" ,
658
592
chain : fullOnly ,
@@ -664,9 +598,8 @@ func TestGetBackupTreeIndexMetadata(t *testing.T) {
664
598
t .Run (tc .name , func (t * testing.T ) {
665
599
subdirTS := intToTime (tc .chain [0 ][1 ]).GoTime ()
666
600
subdir := subdirTS .Format (backupbase .DateBasedIntoFolderName )
667
- end := intToTime (tc .endTime )
668
601
669
- metadatas , err := GetBackupTreeIndexMetadata (ctx , externalStorage , subdir , end )
602
+ metadatas , err := GetBackupTreeIndexMetadata (ctx , externalStorage , subdir )
670
603
if tc .error != "" {
671
604
require .ErrorContains (t , err , tc .error )
672
605
return
0 commit comments