summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKshitij Gupta <kshitij.gupta@mongodb.com>2021-04-29 21:18:20 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-02 17:15:46 +0000
commitc4d2ed3292b0e113135dd85185c27a8235ea1814 (patch)
tree67f0e0751a550b729925400580fdd57ce4ea9f88
parent2b3b8a6e068b2b45d912d364d6ab58f15ff49baa (diff)
downloadmongo-c4d2ed3292b0e113135dd85185c27a8235ea1814.tar.gz
SERVER-52864: Wait for state doc to be fully replicated to all the
secondaries.
-rw-r--r--jstests/replsets/libs/tenant_migration_test.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/jstests/replsets/libs/tenant_migration_test.js b/jstests/replsets/libs/tenant_migration_test.js
index 32747a1f3f5..a33720e22e7 100644
--- a/jstests/replsets/libs/tenant_migration_test.js
+++ b/jstests/replsets/libs/tenant_migration_test.js
@@ -326,7 +326,8 @@ function TenantMigrationTest({
this.isDonorNodeInExpectedState = function(node, migrationId, tenantId, expectedState) {
const configDonorsColl =
this.getDonorPrimary().getCollection(TenantMigrationTest.kConfigDonorsNS);
- if (configDonorsColl.findOne({_id: migrationId}).state !== expectedState) {
+ const configDoc = configDonorsColl.findOne({_id: migrationId});
+ if (!configDoc || configDoc.state !== expectedState) {
return false;
}
@@ -370,7 +371,8 @@ function TenantMigrationTest({
node, migrationId, tenantId, expectedState, expectedAccessState) {
const configRecipientsColl =
this.getRecipientPrimary().getCollection("config.tenantMigrationRecipients");
- if (configRecipientsColl.findOne({_id: migrationId}).state !== expectedState) {
+ const configDoc = configRecipientsColl.findOne({_id: migrationId});
+ if (!configDoc || configDoc.state !== expectedState) {
return false;
}