diff options
author | Pavithra Vetriselvan <pavithra.vetriselvan@mongodb.com> | 2019-11-08 23:33:59 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-08 23:33:59 +0000 |
commit | a53094d8550957c635ce58d7e83dd6d2d64db73e (patch) | |
tree | bb29f933399babdfd18fc47f70221438d06a8f0b | |
parent | c77a933373d8a0109d46f8c38842b8b9a47744c5 (diff) | |
download | mongo-a53094d8550957c635ce58d7e83dd6d2d64db73e.tar.gz |
SERVER-43972 initial_sync_capped_index.js waits for SECONDARY state before running validate
(cherry picked from commit 4cd46444fb5eae68fe40dbbbcbddc209c2eb494f)
-rw-r--r-- | jstests/replsets/initial_sync_capped_index.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jstests/replsets/initial_sync_capped_index.js b/jstests/replsets/initial_sync_capped_index.js index 66895864d03..34ed561e3ce 100644 --- a/jstests/replsets/initial_sync_capped_index.js +++ b/jstests/replsets/initial_sync_capped_index.js @@ -27,6 +27,7 @@ "use strict"; load("jstests/libs/check_log.js"); + load("jstests/replsets/rslib.js"); // for waitForState /** * Overflow a capped collection 'coll' by continuously inserting a given document, @@ -116,6 +117,10 @@ // Wait until initial sync completes. replTest.awaitReplication(); + // Before validating the secondary, confirm that it is in the SECONDARY state. Otherwise, the + // validate command will fail. + waitForState(secondary, ReplSetTest.State.SECONDARY); + // Make sure the indexes created during initial sync are valid. var secondaryCappedColl = secondary.getDB(dbName)[cappedCollName]; var validate_result = secondaryCappedColl.validate(true); @@ -123,4 +128,5 @@ "Index validation of '" + secondaryCappedColl.name + "' failed: " + tojson(validate_result); assert(validate_result.valid, failMsg); replTest.stopSet(); + })(); |