Skip to content

Commit e54dba9

Browse files
committed
tidy
1 parent 5c0dc2f commit e54dba9

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

rest/replicatortest/replicator_test.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,11 @@ func TestReplicationStatusActions(t *testing.T) {
709709
base.RequireNumTestBuckets(t, 2)
710710
base.SetUpTestLogging(t, base.LevelInfo, base.KeyReplicate, base.KeyHTTP, base.KeyHTTPResp, base.KeySync, base.KeySyncMsg)
711711

712-
// Increase checkpoint persistence frequency for cross-node status verification
713-
defer reduceTestCheckpointInterval(50 * time.Millisecond)()
714-
715712
sgrRunner := rest.NewSGRTestRunner(t)
716713
sgrRunner.Run(func(t *testing.T) {
714+
// Increase checkpoint persistence frequency for cross-node status verification
715+
reduceCheckpointInterval := reduceTestCheckpointInterval(50 * time.Millisecond)
716+
t.Cleanup(reduceCheckpointInterval)
717717
rt1, rt2, remoteURLString := sgrRunner.SetupSGRPeers(t)
718718

719719
// Create doc1 on rt2
@@ -832,10 +832,11 @@ func TestReplicationRebalancePull(t *testing.T) {
832832
base.RequireNumTestBuckets(t, 2)
833833
base.SetUpTestLogging(t, base.LevelInfo, base.KeyReplicate, base.KeyHTTP, base.KeyHTTPResp, base.KeySync, base.KeySyncMsg)
834834

835-
// Increase checkpoint persistence frequency for cross-node status verification
836-
defer reduceTestCheckpointInterval(50 * time.Millisecond)()
837835
sgrRunner := rest.NewSGRTestRunner(t)
838836
sgrRunner.Run(func(t *testing.T) {
837+
// Increase checkpoint persistence frequency for cross-node status verification
838+
reduceCheckpointInterval := reduceTestCheckpointInterval(50 * time.Millisecond)
839+
t.Cleanup(reduceCheckpointInterval)
839840
activeRT, remoteRT, remoteURLString := sgrRunner.SetupSGRPeers(t)
840841

841842
// Create docs on remote
@@ -935,11 +936,11 @@ func TestReplicationRebalancePush(t *testing.T) {
935936
base.RequireNumTestBuckets(t, 2)
936937
base.SetUpTestLogging(t, base.LevelInfo, base.KeyReplicate, base.KeyHTTP, base.KeyHTTPResp, base.KeySync, base.KeySyncMsg)
937938

938-
// Increase checkpoint persistence frequency for cross-node status verification
939-
defer reduceTestCheckpointInterval(50 * time.Millisecond)()
940-
941939
sgrRunner := rest.NewSGRTestRunner(t)
942940
sgrRunner.Run(func(t *testing.T) {
941+
// Increase checkpoint persistence frequency for cross-node status verification
942+
reduceCheckpointInterval := reduceTestCheckpointInterval(50 * time.Millisecond)
943+
t.Cleanup(reduceCheckpointInterval)
943944
activeRT, remoteRT, remoteURLString := sgrRunner.SetupSGRPeers(t)
944945

945946
// Create docs on active
@@ -1740,14 +1741,15 @@ func TestReplicationHeartbeatRemoval(t *testing.T) {
17401741
if !base.IsEnterpriseEdition() {
17411742
t.Skipf("test is EE only (replication rebalance)")
17421743
}
1743-
// Increase checkpoint persistence frequency for cross-node status verification
1744-
defer reduceTestCheckpointInterval(50 * time.Millisecond)()
17451744

17461745
base.RequireNumTestBuckets(t, 2)
17471746
base.SetUpTestLogging(t, base.LevelInfo, base.KeyReplicate, base.KeyHTTP, base.KeyHTTPResp, base.KeySync, base.KeySyncMsg)
17481747

17491748
sgrRunner := rest.NewSGRTestRunner(t)
17501749
sgrRunner.Run(func(t *testing.T) {
1750+
// Increase checkpoint persistence frequency for cross-node status verification
1751+
reduceCheckpointInterval := reduceTestCheckpointInterval(50 * time.Millisecond)
1752+
t.Cleanup(reduceCheckpointInterval)
17511753
restartBatching := db.SuspendSequenceBatching()
17521754
t.Cleanup(restartBatching)
17531755

@@ -1952,7 +1954,7 @@ func TestPushReplicationAPIUpdateDatabase(t *testing.T) {
19521954
rt1, rt2, remoteURLString := sgrRunner.SetupSGRPeers(t)
19531955

19541956
// Create initial doc on rt1
1955-
docID := t.Name() + "rt1doc"
1957+
docID := rest.SafeDocumentName(t, t.Name()+"rt1doc")
19561958
_ = rt1.PutDoc(docID, `{"source":"rt1","channels":["alice"]}`)
19571959

19581960
// Create push replication, verify running
@@ -4826,7 +4828,7 @@ func TestActiveReplicatorRecoverFromRemoteRollback(t *testing.T) {
48264828

48274829
base.RequireNumTestBuckets(t, 2)
48284830

4829-
base.SetUpTestLogging(t, base.LevelDebug, base.KeyAll) //base.KeyBucket, base.KeyReplicate, base.KeyHTTP, base.KeyHTTPResp, base.KeySync, base.KeySyncMsg)
4831+
base.SetUpTestLogging(t, base.LevelDebug, base.KeyBucket, base.KeyReplicate, base.KeyHTTP, base.KeyHTTPResp, base.KeySync, base.KeySyncMsg)
48304832

48314833
const username = "alice"
48324834
sgrRunner := rest.NewSGRTestRunner(t)
@@ -5975,7 +5977,7 @@ func TestSGR2TombstoneConflictHandling(t *testing.T) {
59755977
localActiveRT.WaitForReplicationStatus("replication", db.ReplicationStateStopped)
59765978

59775979
// Delete on the short branch and make another doc on the longer branch before deleting it
5978-
deleteVersion := rest.DocVersion{}
5980+
var deleteVersion rest.DocVersion
59795981
if test.longestBranchLocal {
59805982
// Delete doc on remote
59815983
deletedVersion := remotePassiveRT.DeleteDoc(doc2ID, doc2Version)
@@ -7281,7 +7283,8 @@ func TestReplicatorCheckpointOnStop(t *testing.T) {
72817283

72827284
// increase checkpointing interval temporarily to ensure the checkpointer doesn't fire on an
72837285
// interval during the running of the test
7284-
defer reduceTestCheckpointInterval(9999 * time.Hour)()
7286+
reduceCheckpointInterval := reduceTestCheckpointInterval(9999 * time.Hour)
7287+
t.Cleanup(reduceCheckpointInterval)
72857288

72867289
collection, ctx := activeRT.GetSingleTestDatabaseCollectionWithUser()
72877290
revID, doc, err := collection.Put(ctx, "test", db.Body{})

rest/revocation_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,8 +1647,8 @@ func TestReplicatorRevocationsNoRevButAlternateAccess(t *testing.T) {
16471647

16481648
base.RequireNumTestBuckets(t, 2)
16491649

1650-
sgrRunne := NewSGRTestRunner(t)
1651-
sgrRunne.Run(func(t *testing.T) {
1650+
sgrRunner := NewSGRTestRunner(t)
1651+
sgrRunner.Run(func(t *testing.T) {
16521652
// Passive
16531653
revocationTester, rt2 := InitScenario(t, nil)
16541654
defer rt2.Close()
@@ -1699,7 +1699,7 @@ func TestReplicatorRevocationsNoRevButAlternateAccess(t *testing.T) {
16991699
PurgeOnRemoval: true,
17001700
ReplicationStatsMap: dbstats,
17011701
CollectionsEnabled: base.TestsUseNamedCollections(),
1702-
SupportedBLIPProtocols: sgrRunne.SupportedSubprotocols,
1702+
SupportedBLIPProtocols: sgrRunner.SupportedSubprotocols,
17031703
})
17041704
require.NoError(t, err)
17051705

0 commit comments

Comments
 (0)