Skip to content

Commit 2d81f46

Browse files
committed
DurabilityBucketTest: Add setVBucketToActiveWithValidTopology helper
Use setVBucketToActiveWithValidTopology() in DurabilityBucketTest test to simplify setup. Change-Id: I1a736fd03d950a8f487003815bb71e7686682613 Reviewed-on: http://review.couchbase.org/112352 Tested-by: Build Bot <[email protected]> Reviewed-by: Ben Huddleston <[email protected]>
1 parent 4ae5744 commit 2d81f46

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

engines/ep/tests/module_tests/evp_store_durability_test.cc

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,9 @@ TEST_P(DurabilityBucketTest, DeleteDurabilityInvalidLevel) {
15061506
/// SyncWrite in progress against a key, instead of returning EEXISTS as add()
15071507
/// would normally if it found an existing item. (Until the first SyncWrite
15081508
/// completes there's no user-visible value for the key.
1509-
TEST_P(DurabilityEPBucketTest, AddIfAlreadyExistsSyncWriteInProgress) {
1509+
TEST_P(DurabilityBucketTest, AddIfAlreadyExistsSyncWriteInProgress) {
1510+
setVBucketToActiveWithValidTopology();
1511+
15101512
// Setup: Add the first prepared SyncWrite.
15111513
auto key = makeStoredDocKey("key");
15121514
auto pending = makePendingItem(key, "value");
@@ -1570,10 +1572,7 @@ TEST_P(DurabilityBucketTest, DeleteIfSyncWriteInProgressSyncWriteInProgress) {
15701572
}
15711573

15721574
TEST_P(DurabilityBucketTest, TakeoverSendsDurabilityAmbiguous) {
1573-
setVBucketStateAndRunPersistTask(
1574-
vbid,
1575-
vbucket_state_active,
1576-
{{"topology", nlohmann::json::array({{"active", "replica"}})}});
1575+
setVBucketToActiveWithValidTopology();
15771576

15781577
// Make pending
15791578
auto key = makeStoredDocKey("key");
@@ -1662,10 +1661,7 @@ TEST_F(DurabilityRespondAmbiguousTest, RespondAmbiguousNotificationDeadLock) {
16621661
// to report the SyncWrite was timed out with status eambiguous, the outstanding
16631662
// cookie context was not correctly cleared.
16641663
TEST_P(DurabilityBucketTest, MutationAfterTimeoutCorrect) {
1665-
setVBucketStateAndRunPersistTask(
1666-
vbid,
1667-
vbucket_state_active,
1668-
{{"topology", nlohmann::json::array({{"active", "replica"}})}});
1664+
setVBucketToActiveWithValidTopology();
16691665

16701666
// Setup: make pending item and store it; then abort it (at VBucket) level.
16711667
auto key = makeStoredDocKey("key");
@@ -1750,10 +1746,7 @@ TEST_P(DurabilityEPBucketTest, DoNotExpirePendingItem) {
17501746
* compaction does not misinterpret the state of the prepare and try to
17511747
* expire it.
17521748
*/
1753-
setVBucketStateAndRunPersistTask(
1754-
vbid,
1755-
vbucket_state_active,
1756-
{{"topology", nlohmann::json::array({{"active", "replica"}})}});
1749+
setVBucketToActiveWithValidTopology();
17571750
using namespace cb::durability;
17581751

17591752
auto key1 = makeStoredDocKey("key1");
@@ -1853,10 +1846,7 @@ TEST_P(DurabilityEphemeralBucketTest, PurgeCompletedAbort) {
18531846
// prepares from the ADM to the new PDM in such a switch over. This test
18541847
// demonstrates the issue and exercises the fix.
18551848
TEST_P(DurabilityBucketTest, ActiveToReplicaAndCommit) {
1856-
setVBucketStateAndRunPersistTask(
1857-
vbid,
1858-
vbucket_state_active,
1859-
{{"topology", nlohmann::json::array({{"active", "replica"}})}});
1849+
setVBucketToActiveWithValidTopology();
18601850

18611851
// seqno:1 A prepare, that does not commit yet.
18621852
auto key = makeStoredDocKey("crikey");

0 commit comments

Comments
 (0)