summaryrefslogtreecommitdiff
path: root/jstests/replsets/libs
diff options
context:
space:
mode:
authorSuganthi Mani <suganthi.mani@mongodb.com>2022-02-03 06:42:19 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-03 07:47:41 +0000
commitec97c7f137a73faa8579c5616e364b86e6cf56c8 (patch)
treeddcd276d6c2bf878f8cb9cc830b3a33af21f26a4 /jstests/replsets/libs
parent71287a3a8f033923ca9c2735c72da4460fbbf06d (diff)
downloadmongo-ec97c7f137a73faa8579c5616e364b86e6cf56c8.tar.gz
SERVER-61133 Copy donor files to temp directory.
Diffstat (limited to 'jstests/replsets/libs')
-rw-r--r--jstests/replsets/libs/tenant_migration_test.js57
1 files changed, 47 insertions, 10 deletions
diff --git a/jstests/replsets/libs/tenant_migration_test.js b/jstests/replsets/libs/tenant_migration_test.js
index 0e70ca11dbc..0e8ac919704 100644
--- a/jstests/replsets/libs/tenant_migration_test.js
+++ b/jstests/replsets/libs/tenant_migration_test.js
@@ -306,7 +306,14 @@ function TenantMigrationTest({
recipientNodes.forEach(node => {
const configRecipientsColl =
node.getCollection(TenantMigrationTest.kConfigRecipientsNS);
- assert.soon(() => 0 === configRecipientsColl.count({_id: migrationId}));
+ assert.soon(() => 0 === configRecipientsColl.count({_id: migrationId}), tojson(node));
+
+ let mtab;
+ assert.soon(() => {
+ mtab =
+ this.getTenantMigrationAccessBlocker({recipientNode: node, tenantId: tenantId});
+ return !mtab;
+ }, tojson(mtab));
});
};
@@ -350,6 +357,11 @@ function TenantMigrationTest({
return (mtab.donor.state === expectedAccessState);
};
+ function buildErrorMsg(
+ migrationId, expectedState, expectedAccessState, configDoc, recipientMtab) {
+ return tojson({migrationId, expectedState, expectedAccessState, configDoc, recipientMtab});
+ }
+
/**
* Asserts that the migration 'migrationId' and 'tenantId' eventually goes to the expected state
* on all the given recipient nodes.
@@ -357,8 +369,21 @@ function TenantMigrationTest({
this.waitForRecipientNodesToReachState = function(
nodes, migrationId, tenantId, expectedState, expectedAccessState) {
nodes.forEach(node => {
- assert.soon(() => this.isRecipientNodeInExpectedState(
- node, migrationId, tenantId, expectedState, expectedAccessState));
+ let result = {};
+ assert.soon(
+ () => {
+ result = this.isRecipientNodeInExpectedState(
+ node, migrationId, tenantId, expectedState, expectedAccessState);
+ return result.value;
+ },
+ () => {
+ return "waitForRecipientNodesToReachState failed: " +
+ buildErrorMsg(migrationId,
+ expectedState,
+ expectedAccessState,
+ result.configDoc,
+ result.recipientMtab);
+ });
});
};
@@ -369,8 +394,16 @@ function TenantMigrationTest({
this.assertRecipientNodesInExpectedState = function(
nodes, migrationId, tenantId, expectedState, expectedAccessState) {
nodes.forEach(node => {
- assert(this.isRecipientNodeInExpectedState(
- node, migrationId, tenantId, expectedState, expectedAccessState));
+ let result = this.isRecipientNodeInExpectedState(
+ node, migrationId, tenantId, expectedState, expectedAccessState);
+ assert(result.value, () => {
+ return "assertRecipientNodesInExpectedState failed: " +
+ buildErrorMsg(migrationId,
+ expectedState,
+ expectedAccessState,
+ result.configDoc,
+ result.recipientMtab);
+ });
});
};
@@ -383,12 +416,16 @@ function TenantMigrationTest({
const configRecipientsColl =
this.getRecipientPrimary().getCollection("config.tenantMigrationRecipients");
const configDoc = configRecipientsColl.findOne({_id: migrationId});
- if (!configDoc || configDoc.state !== expectedState) {
- return false;
- }
-
const mtab = this.getTenantMigrationAccessBlocker({recipientNode: node, tenantId});
- return (mtab.recipient.state === expectedAccessState);
+
+ let checkStates = () => {
+ if (!configDoc || configDoc.state !== expectedState) {
+ return false;
+ }
+ return (mtab.recipient.state === expectedAccessState);
+ };
+
+ return {value: checkStates(), configDoc: configDoc, recipientMtab: mtab.recipient};
};
function loadDummyData() {