summaryrefslogtreecommitdiff
path: root/jstests/replsets/tenant_migration_commit_transaction_retry.js
diff options
context:
space:
mode:
authorXueruiFa <xuerui.fa@mongodb.com>2020-10-19 18:17:01 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-17 14:02:49 +0000
commit519bc2b24ecc6c29f2483c8b82786e16f61c2cba (patch)
tree1689c9416eb3d5fc06b616f60c7635e581c989f8 /jstests/replsets/tenant_migration_commit_transaction_retry.js
parent9b0e366a75a9cc25705969932b3374d21d4d13c9 (diff)
downloadmongo-519bc2b24ecc6c29f2483c8b82786e16f61c2cba.tar.gz
SERVER-51596: Create TenantMigrationTest test fixture for JS tests
Diffstat (limited to 'jstests/replsets/tenant_migration_commit_transaction_retry.js')
-rw-r--r--jstests/replsets/tenant_migration_commit_transaction_retry.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/jstests/replsets/tenant_migration_commit_transaction_retry.js b/jstests/replsets/tenant_migration_commit_transaction_retry.js
index 49b07ec2f6c..a0eb97b217e 100644
--- a/jstests/replsets/tenant_migration_commit_transaction_retry.js
+++ b/jstests/replsets/tenant_migration_commit_transaction_retry.js
@@ -10,6 +10,7 @@
// Direct writes to config.transactions cannot be part of a session.
TestData.disableImplicitSessions = true;
+load("jstests/replsets/libs/tenant_migration_test.js");
load("jstests/replsets/libs/tenant_migration_util.js");
load("jstests/replsets/rslib.js");
load("jstests/libs/uuid_util.js");
@@ -48,9 +49,10 @@ donorRst.initiate();
recipientRst.startSet();
recipientRst.initiate();
+const tenantMigrationTest = new TenantMigrationTest({name: jsTestName(), donorRst, recipientRst});
+
const kTenantId = "testTenantId";
-const kDbName = kTenantId + "_" +
- "testDb";
+const kDbName = tenantMigrationTest.tenantDB(kTenantId, "testDB");
const kCollName = "testColl";
const kNs = `${kDbName}.${kCollName}`;
@@ -80,18 +82,15 @@ jsTest.log("Run a migration to completion");
const migrationId = UUID();
const migrationOpts = {
migrationIdString: extractUUIDFromObject(migrationId),
- recipientConnString: recipientRst.getURL(),
tenantId: kTenantId,
- readPreference: {mode: "primary"},
};
-assert.commandWorked(TenantMigrationUtil.startMigration(donorPrimary.host, migrationOpts));
+assert.commandWorked(tenantMigrationTest.runMigration(migrationOpts));
const donorDoc =
donorPrimary.getCollection("config.tenantMigrationDonors").findOne({tenantId: kTenantId});
-assert.commandWorked(
- donorPrimary.adminCommand({donorForgetMigration: 1, migrationId: migrationId}));
-TenantMigrationUtil.waitForMigrationGarbageCollection(donorRst.nodes, migrationId, kTenantId);
+assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
+tenantMigrationTest.waitForMigrationGarbageCollection(donorRst.nodes, migrationId, kTenantId);
{
jsTest.log("Run another transaction after the migration");