summaryrefslogtreecommitdiff
path: root/jstests/replsets/tenant_migration_donor_state_machine.js
diff options
context:
space:
mode:
authorWenbin Zhu <wenbin.zhu@mongodb.com>2021-05-12 19:25:22 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-12 20:25:00 +0000
commit1cb18cbb349e71cbd869c48c1e288527b48d6d73 (patch)
treebc8359efb04b084fc85900648b41bbc737af9a93 /jstests/replsets/tenant_migration_donor_state_machine.js
parentf536417348fb67079a4efeda9afe6d3baebc7860 (diff)
downloadmongo-1cb18cbb349e71cbd869c48c1e288527b48d6d73.tar.gz
SERVER-55202 Add assertion if migration committed or aborted in TenantMigrationTest fixture.
Diffstat (limited to 'jstests/replsets/tenant_migration_donor_state_machine.js')
-rw-r--r--jstests/replsets/tenant_migration_donor_state_machine.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/jstests/replsets/tenant_migration_donor_state_machine.js b/jstests/replsets/tenant_migration_donor_state_machine.js
index 7441ab7abf9..b88cc76cada 100644
--- a/jstests/replsets/tenant_migration_donor_state_machine.js
+++ b/jstests/replsets/tenant_migration_donor_state_machine.js
@@ -178,9 +178,8 @@ function testStats(node, {
// Allow the migration to complete.
blockingFp.off();
- const stateRes =
- assert.commandWorked(tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted);
+ TenantMigrationTest.assertCommitted(
+ tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
donorDoc = configDonorsColl.findOne({tenantId: kTenantId});
let commitOplogEntry = donorPrimary.getDB("local").oplog.rs.findOne(
@@ -220,9 +219,8 @@ function testStats(node, {
configureFailPoint(recipientPrimary,
"fpBeforeFulfillingDataConsistentPromise",
{action: "stop", stopErrorCode: ErrorCodes.InternalError});
- const stateRes = assert.commandWorked(tenantMigrationTest.runMigration(
+ TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration(
migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kAborted);
abortRecipientFp.off();
const donorDoc = configDonorsColl.findOne({tenantId: kTenantId});
@@ -263,9 +261,8 @@ function testStats(node, {
let abortDonorFp =
configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState");
- const stateRes = assert.commandWorked(tenantMigrationTest.runMigration(
+ TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration(
migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kAborted);
abortDonorFp.off();
const donorDoc = configDonorsColl.findOne({tenantId: kTenantId});
@@ -313,9 +310,8 @@ configDonorsColl.dropIndex({expireAt: 1});
donorPrimary.adminCommand({donorForgetMigration: 1, migrationId: migrationId}),
ErrorCodes.NoSuchTenantMigration);
- const stateRes = assert.commandWorked(tenantMigrationTest.runMigration(
+ TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration(
migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted);
assert.commandWorked(
donorPrimary.adminCommand({donorForgetMigration: 1, migrationId: migrationId}));