@@ -6919,6 +6919,7 @@ func TestReplicatorConflictAttachment(t *testing.T) {
6919
6919
})
6920
6920
}
6921
6921
}
6922
+
6922
6923
func TestConflictResolveMergeWithMutatedRev (t * testing.T ) {
6923
6924
base .SetUpTestLogging (t , base .LevelDebug , base .KeyAll )
6924
6925
@@ -7570,45 +7571,27 @@ func TestReplicatorDeprecatedCredentials(t *testing.T) {
7570
7571
func TestReplicatorCheckpointOnStop (t * testing.T ) {
7571
7572
base .RequireNumTestBuckets (t , 2 )
7572
7573
7573
- passiveRT := rest .NewRestTester (t , nil )
7574
- defer passiveRT .Close ()
7575
-
7576
- adminSrv := httptest .NewServer (passiveRT .TestAdminHandler ())
7577
- defer adminSrv .Close ()
7578
-
7579
- activeRT := rest .NewRestTester (t , nil )
7580
- defer activeRT .Close ()
7574
+ activeRT , passiveRT , remoteURL , teardown := rest .SetupSGRPeers (t )
7575
+ defer teardown ()
7581
7576
activeCtx := activeRT .Context ()
7582
7577
7583
7578
// Disable checkpointing at an interval
7584
7579
activeRT .GetDatabase ().SGReplicateMgr .CheckpointInterval = 0
7585
- err := activeRT .GetDatabase ().SGReplicateMgr .StartReplications (activeCtx )
7586
- require .NoError (t , err )
7587
7580
7588
7581
rev , doc , err := activeRT .GetSingleTestDatabaseCollectionWithUser ().Put (activeCtx , "test" , db.Body {})
7589
7582
require .NoError (t , err )
7590
7583
seq := strconv .FormatUint (doc .Sequence , 10 )
7591
7584
7592
- replConfig := `
7593
- {
7594
- "replication_id": "` + t .Name () + `",
7595
- "remote": "` + adminSrv .URL + `/db",
7596
- "direction": "push",
7597
- "continuous": true,
7598
- "collections_enabled": ` + strconv .FormatBool (! activeRT .GetDatabase ().OnlyDefaultCollection ()) + `
7599
- }
7600
- `
7601
- resp := activeRT .SendAdminRequest ("POST" , "/{{.db}}/_replication/" , replConfig )
7602
- rest .RequireStatus (t , resp , 201 )
7603
-
7585
+ activeRT .CreateReplication (t .Name (), remoteURL , db .ActiveReplicatorTypePush , nil , true , db .ConflictResolverDefault )
7604
7586
activeRT .WaitForReplicationStatus (t .Name (), db .ReplicationStateRunning )
7605
7587
7606
7588
err = passiveRT .WaitForRev ("test" , rev )
7607
7589
require .NoError (t , err )
7608
7590
7609
- _ , err = activeRT .GetDatabase ().SGReplicateMgr .PutReplicationStatus (t .Name (), "stop" )
7610
- require .NoError (t , err )
7611
- activeRT .WaitForReplicationStatus (t .Name (), db .ReplicationStateStopped )
7591
+ // stop active replicator explicitly
7592
+ ar , ok := activeRT .GetDatabase ().SGReplicateMgr .GetLocalActiveReplicatorForTest (t , t .Name ())
7593
+ assert .True (t , ok )
7594
+ require .NoError (t , ar .Stop ())
7612
7595
7613
7596
// Check checkpoint document was wrote to bucket with correct status
7614
7597
// _sync:local:checkpoint/sgr2cp:push:TestReplicatorCheckpointOnStop
0 commit comments