summaryrefslogtreecommitdiff
path: root/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/tenant_migration_concurrent_reads_on_donor.js')
-rw-r--r--jstests/replsets/tenant_migration_concurrent_reads_on_donor.js21
1 files changed, 8 insertions, 13 deletions
diff --git a/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js b/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js
index 8968ffc17e6..70e97620ad5 100644
--- a/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js
+++ b/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js
@@ -110,9 +110,8 @@ function testRejectReadsAfterMigrationCommitted(testCase, dbName, collName) {
const donorRst = tenantMigrationTest.getDonorRst();
const donorPrimary = donorRst.getPrimary();
- const stateRes = assert.commandWorked(tenantMigrationTest.runMigration(
+ TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration(
migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted);
// Wait for the last oplog entry on the primary to be visible in the committed snapshot view of
// the oplog on all the secondaries. This is to ensure that snapshot reads on secondaries with
@@ -164,9 +163,8 @@ function testDoNotRejectReadsAfterMigrationAborted(testCase, dbName, collName) {
let abortFp =
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);
abortFp.off();
// Wait for the last oplog entry on the primary to be visible in the committed snapshot view of
@@ -244,9 +242,8 @@ function testBlockReadsAfterMigrationEnteredBlocking(testCase, dbName, collName)
});
blockingFp.off();
- const stateRes =
- assert.commandWorked(tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted);
+ TenantMigrationTest.assertCommitted(
+ tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
}
@@ -308,9 +305,8 @@ function testRejectBlockedReadsAfterMigrationCommitted(testCase, dbName, collNam
// Verify that the migration succeeded.
resumeMigrationThread.join();
- const stateRes =
- assert.commandWorked(tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted);
+ TenantMigrationTest.assertCommitted(
+ tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
}
@@ -376,9 +372,8 @@ function testUnblockBlockedReadsAfterMigrationAborted(testCase, dbName, collName
// Verify that the migration failed due to the simulated error.
resumeMigrationThread.join();
abortFp.off();
- const stateRes =
- assert.commandWorked(tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
- assert.eq(stateRes.state, TenantMigrationTest.DonorState.kAborted);
+ TenantMigrationTest.assertAborted(
+ tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
}