summaryrefslogtreecommitdiff
path: root/jstests/replsets/rollback2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/rollback2.js')
-rw-r--r--jstests/replsets/rollback2.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/jstests/replsets/rollback2.js b/jstests/replsets/rollback2.js
index 46fb548..7ab3c6b 100644
--- a/jstests/replsets/rollback2.js
+++ b/jstests/replsets/rollback2.js
@@ -202,9 +202,24 @@ doTest = function (signal) {
wait(function () { return B.isMaster().ismaster || B.isMaster().secondary; });
// everyone is up here...
- assert(A.isMaster().ismaster || A.isMaster().secondary, "A up");
- assert(B.isMaster().ismaster || B.isMaster().secondary, "B up");
replTest.awaitReplication();
+
+ // theoretically, a read could slip in between StateBox::change() printing
+ // replSet SECONDARY
+ // and the replset actually becoming secondary
+ // so we're trying to wait for that here
+ print("waiting for secondary");
+ assert.soon(function() {
+ try {
+ var aim = A.isMaster();
+ var bim = B.isMaster();
+ return (aim.ismaster || aim.secondary) &&
+ (bim.ismaster || bim.secondary);
+ }
+ catch(e) {
+ print("checking A and B: "+e);
+ }
+ });
verify(a);