summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2015-01-20 15:26:04 -0500
committerRandolph Tan <randolph@10gen.com>2015-01-20 16:47:11 -0500
commite422f31cd27565cdeb9f85b95f42b33852525c90 (patch)
tree76dd9cc6e6e6021721fe7b0152ee15f931ffe86e
parentee33a8fc2a840e05c7d3f5ea7d840b4ae23112f7 (diff)
downloadmongo-e422f31cd27565cdeb9f85b95f42b33852525c90.tar.gz
SERVER-16955 Wait for mongos to recognize new master before proceeding in rename.js
-rw-r--r--jstests/sharding/rename.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/jstests/sharding/rename.js b/jstests/sharding/rename.js
index 6671d936006..cc8a391bddf 100644
--- a/jstests/sharding/rename.js
+++ b/jstests/sharding/rename.js
@@ -33,12 +33,18 @@ assert.eq(db.foo.count(), 0, '3.3');
// Ensure write concern works by shutting down 1 node in a replica set shard.
jsTest.log("Testing write concern (2)");
-replTest.stop(replTest.getNodeId(replTest.getSecondary()));
+// Kill any node. Don't care if it's a primary or secondary.
+replTest.stop(0);
-db.foo.insert({_id:4});
-printjson(db.foo.renameCollection('bar', true));
+replTest.awaitSecondaryNodes();
+ReplSetTest.awaitRSClientHosts(s.s,
+ replTest.getPrimary(),
+ { ok: true, ismaster: true },
+ replTest.name);
+
+assert.writeOK(db.foo.insert({ _id: 4 }));
+assert.commandWorked(db.foo.renameCollection('bar', true));
ans = db.runCommand({getLastError:1, w:3, wtimeout:5000});
-printjson(ans);
-assert.eq(ans.err, "timeout", '4.0');
+assert.eq(ans.err, "timeout", 'gle: ' + tojson(ans));
s.stop();