diff options
author | Kristina <kristina@10gen.com> | 2011-07-25 22:14:14 -0400 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2011-07-25 22:14:14 -0400 |
commit | 302856ab3292acd58052e5e4a8af9389f6bd7f3f (patch) | |
tree | 09184e20cd9092fdfbd1b3358e89ac3c075075b2 | |
parent | d54ce5475c30358887c5d385714e96daa337c761 (diff) | |
download | mongo-302856ab3292acd58052e5e4a8af9389f6bd7f3f.tar.gz |
fix test to check for recovering state before proceeding
-rw-r--r-- | jstests/replsets/rollback2.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/jstests/replsets/rollback2.js b/jstests/replsets/rollback2.js index 46fb548ccdf..7ab3c6bf4ee 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); |