33
44using System ;
55using System . Collections . Generic ;
6+ using System . Diagnostics ;
67using System . IO ;
78using System . Linq ;
89using System . Net ;
@@ -732,24 +733,31 @@ public void ClusterFailoverAttachReplicas([Values] bool performRMW, [Values] boo
732733
733734 [ Test , Order ( 13 ) ]
734735 [ Category ( "REPLICATION" ) ]
736+ //[Repeat(20)]
735737 public void ClusterReplicationCheckpointCleanupTest ( [ Values ] bool performRMW , [ Values ] bool disableObjects , [ Values ] bool enableIncrementalSnapshots )
736738 {
739+ if ( TestContext . CurrentContext . CurrentRepeatCount > 0 )
740+ Debug . WriteLine ( $ "*** Current test iteration: { TestContext . CurrentContext . CurrentRepeatCount + 1 } , name = { TestContext . CurrentContext . Test . Name } ***") ;
741+
742+ var primaryIndex = 0 ;
743+ var replicaIndex = 1 ;
737744 var replica_count = 1 ; //Per primary
738745 var primary_count = 1 ;
739746 var nodes_count = primary_count + ( primary_count * replica_count ) ;
740747 ClassicAssert . IsTrue ( primary_count > 0 ) ;
741748 context . CreateInstances ( nodes_count , tryRecover : true , disableObjects : disableObjects , lowMemory : true , segmentSize : "4k" , EnableIncrementalSnapshots : enableIncrementalSnapshots , enableAOF : true , useTLS : useTLS , asyncReplay : asyncReplay , deviceType : Tsavorite . core . DeviceType . Native ) ;
742749 context . CreateConnection ( useTLS : useTLS ) ;
743- ClassicAssert . AreEqual ( "OK" , context . clusterTestUtils . AddDelSlotsRange ( 0 , [ ( 0 , 16383 ) ] , true , context . logger ) ) ;
744- context . clusterTestUtils . BumpEpoch ( 0 , logger : context . logger ) ;
745750
746- var cconfig = context . clusterTestUtils . ClusterNodes ( 0 , context . logger ) ;
751+ // Setup cluster
752+ context . SimplePrimaryReplicaSetup ( ) ;
753+
754+ var cconfig = context . clusterTestUtils . ClusterNodes ( primaryIndex , context . logger ) ;
747755 var myself = cconfig . Nodes . First ( ) ;
748756 var slotRangesStr = string . Join ( "," , myself . Slots . Select ( x => $ "({ x . From } -{ x . To } )") . ToList ( ) ) ;
749757 ClassicAssert . AreEqual ( 1 , myself . Slots . Count , $ "Setup failed slot ranges count greater than 1 { slotRangesStr } ") ;
750758
751759 var shards = context . clusterTestUtils . ClusterShards ( 0 , context . logger ) ;
752- ClassicAssert . AreEqual ( 1 , shards . Count ) ;
760+ ClassicAssert . AreEqual ( 2 , shards . Count ) ;
753761 ClassicAssert . AreEqual ( 1 , shards [ 0 ] . slotRanges . Count ) ;
754762 ClassicAssert . AreEqual ( 0 , shards [ 0 ] . slotRanges [ 0 ] . Item1 ) ;
755763 ClassicAssert . AreEqual ( 16383 , shards [ 0 ] . slotRanges [ 0 ] . Item2 ) ;
@@ -765,7 +773,7 @@ public void ClusterReplicationCheckpointCleanupTest([Values] bool performRMW, [V
765773 if ( ! attachReplicaTask . Wait ( TimeSpan . FromSeconds ( 60 ) ) )
766774 Assert . Fail ( "attachReplicaTask timeout" ) ;
767775
768- context . clusterTestUtils . WaitForReplicaAofSync ( primaryIndex : 0 , secondaryIndex : 1 , logger : context . logger ) ;
776+ context . clusterTestUtils . WaitForReplicaAofSync ( primaryIndex : primaryIndex , secondaryIndex : replicaIndex , logger : context . logger ) ;
769777 }
770778
771779 [ Test , Order ( 14 ) ]
0 commit comments