diff options
author | Kristina <kristina@10gen.com> | 2012-03-26 15:31:28 -0400 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-03-26 15:31:28 -0400 |
commit | 6a6b4613fc8fd4035a1dee12300dd512411caf10 (patch) | |
tree | d032709fcd78603d44539195b99ddcc50bdbc81c | |
parent | 64f3b376ca0bd04712bb6e02a508a3a0f4fbab63 (diff) | |
download | mongo-6a6b4613fc8fd4035a1dee12300dd512411caf10.tar.gz |
Fix flaky tests and add more debugging
-rw-r--r-- | jstests/replsets/reconfig.js | 18 | ||||
-rw-r--r-- | jstests/replsets/replset_remove_node.js | 13 |
2 files changed, 23 insertions, 8 deletions
diff --git a/jstests/replsets/reconfig.js b/jstests/replsets/reconfig.js index 55ee5050aa5..7d43720b5ad 100644 --- a/jstests/replsets/reconfig.js +++ b/jstests/replsets/reconfig.js @@ -60,10 +60,18 @@ replTest.stopSet(); replTest2 = new ReplSetTest({name : 'testSet2', nodes : 1}); nodes = replTest2.startSet(); -result = nodes[0].getDB("admin").runCommand({replSetInitiate : {_id : "testSet2", members : [ - {_id : 0, tags : ["member0"]} - ]}}); - -assert(result.errmsg.match(/bad or missing host field/) , "error message doesn't match, got result:" + tojson(result) ); +assert.soon(function() { + try { + result = nodes[0].getDB("admin").runCommand({replSetInitiate : {_id : "testSet2", members : [ + {_id : 0, tags : ["member0"]} + ]}}); + printjson(result); + return result.errmsg.match(/bad or missing host field/); + } + catch (e) { + print(e); + } + return false; +}); replTest2.stopSet(); diff --git a/jstests/replsets/replset_remove_node.js b/jstests/replsets/replset_remove_node.js index 9fef721b6dd..bf99b1236fc 100644 --- a/jstests/replsets/replset_remove_node.js +++ b/jstests/replsets/replset_remove_node.js @@ -1,6 +1,6 @@ doTest = function( signal ) { - // Make sure that we can manually shutdown a remove a + // Make sure that we can manually shutdown a remove a // slave from the configuration. // Create a new replica set test. Specify set name and the number of nodes you want. @@ -12,7 +12,14 @@ doTest = function( signal ) { // Call initiate() to send the replSetInitiate command // This will wait for initiation - replTest.initiate(); + var name = replTest.nodeList(); + replTest.initiate({"_id" : "testSet", + "members" : [ + // make sure 0 becomes primary so we don't try to remove the + // primary below + {"_id" : 0, "host" : name[0], priority:2}, + {"_id" : 1, "host" : name[1]}, + {"_id" : 2, "host" : name[2]}]}); // Call getMaster to return a reference to the node that's been // elected master. @@ -41,7 +48,7 @@ doTest = function( signal ) { print(e); } - + // Make sure that a new master comes up master = replTest.getMaster(); slaves = replTest.liveNodes.slaves; |