@@ -2605,47 +2605,54 @@ func TestBlipInternalPropertiesHandling(t *testing.T) {
26052605func TestProcessRevIncrementsStat (t * testing.T ) {
26062606 base .RequireNumTestBuckets (t , 2 )
26072607
2608- activeRT , remoteRT , remoteURLString := SetupSGRPeers (t )
2609- activeCtx := activeRT .Context ()
2608+ sgrRunner := NewSGRTestRunner (t )
26102609
2611- remoteURL , _ := url .Parse (remoteURLString )
2610+ sgrRunner .Run (func (t * testing.T ) {
2611+ activeRT , remoteRT , remoteURLString := sgrRunner .SetupSGRPeers (t )
2612+ activeCtx := activeRT .Context ()
2613+ remoteURL , err := url .Parse (remoteURLString )
2614+ require .NoError (t , err )
26122615
2613- stats , err := base .SyncGatewayStats .NewDBStats ("test" , false , false , false , nil , nil )
2614- require .NoError (t , err )
2615- dbstats , err := stats .DBReplicatorStats (t .Name ())
2616- require .NoError (t , err )
2616+ replicationID := SafeDocumentName (t , t .Name ())
26172617
2618- ar , err := db .NewActiveReplicator (activeCtx , & db.ActiveReplicatorConfig {
2619- ID : t .Name (),
2620- Direction : db .ActiveReplicatorTypePull ,
2621- ActiveDB : & db.Database {DatabaseContext : activeRT .GetDatabase ()},
2622- RemoteDBURL : remoteURL ,
2623- Continuous : true ,
2624- ReplicationStatsMap : dbstats ,
2625- CollectionsEnabled : ! activeRT .GetDatabase ().OnlyDefaultCollection (),
2626- })
2627- require .NoError (t , err )
2618+ stats , err := base .SyncGatewayStats .NewDBStats ("test" , false , false , false , nil , nil )
2619+ require .NoError (t , err )
2620+ dbstats , err := stats .DBReplicatorStats (replicationID )
2621+ require .NoError (t , err )
2622+
2623+ ar , err := db .NewActiveReplicator (activeCtx , & db.ActiveReplicatorConfig {
2624+ ID : replicationID ,
2625+ Direction : db .ActiveReplicatorTypePull ,
2626+ ActiveDB : & db.Database {DatabaseContext : activeRT .GetDatabase ()},
2627+ RemoteDBURL : remoteURL ,
2628+ Continuous : true ,
2629+ ReplicationStatsMap : dbstats ,
2630+ CollectionsEnabled : ! activeRT .GetDatabase ().OnlyDefaultCollection (),
2631+ SupportedBLIPProtocols : sgrRunner .SupportedSubprotocols ,
2632+ })
2633+ require .NoError (t , err )
26282634
2629- // Confirm all stats starting on 0
2630- require .NotNil (t , ar .Pull )
2631- pullStats := ar .Pull .GetStats ()
2632- require .EqualValues (t , 0 , pullStats .HandleRevCount .Value ())
2633- require .EqualValues (t , 0 , pullStats .HandleRevBytes .Value ())
2634- require .EqualValues (t , 0 , pullStats .HandlePutRevCount .Value ())
2635+ // Confirm all stats starting on 0
2636+ require .NotNil (t , ar .Pull )
2637+ pullStats := ar .Pull .GetStats ()
2638+ require .EqualValues (t , 0 , pullStats .HandleRevCount .Value ())
2639+ require .EqualValues (t , 0 , pullStats .HandleRevBytes .Value ())
2640+ require .EqualValues (t , 0 , pullStats .HandlePutRevCount .Value ())
26352641
2636- const docID = "doc"
2637- version := remoteRT .CreateTestDoc (docID )
2642+ const docID = "doc"
2643+ version := remoteRT .CreateTestDoc (docID )
26382644
2639- assert .NoError (t , ar .Start (activeCtx ))
2640- defer func () { require .NoError (t , ar .Stop ()) }()
2645+ assert .NoError (t , ar .Start (activeCtx ))
2646+ defer func () { require .NoError (t , ar .Stop ()) }()
26412647
2642- activeRT .WaitForPendingChanges ()
2643- activeRT .WaitForVersion (docID , version )
2648+ activeRT .WaitForPendingChanges ()
2649+ sgrRunner .WaitForVersion (docID , activeRT , version )
26442650
2645- base .RequireWaitForStat (t , pullStats .HandleRevCount .Value , 1 )
2646- assert .NotEqualValues (t , 0 , pullStats .HandleRevBytes .Value ())
2647- // Confirm connected client count has not increased, which uses same processRev code
2648- assert .EqualValues (t , 0 , pullStats .HandlePutRevCount .Value ())
2651+ base .RequireWaitForStat (t , pullStats .HandleRevCount .Value , 1 )
2652+ assert .NotEqualValues (t , 0 , pullStats .HandleRevBytes .Value ())
2653+ // Confirm connected client count has not increased, which uses same processRev code
2654+ assert .EqualValues (t , 0 , pullStats .HandlePutRevCount .Value ())
2655+ })
26492656}
26502657
26512658// Attempt to send rev as GUEST when read-only guest is enabled
0 commit comments