summaryrefslogtreecommitdiff
path: root/jstests/gle
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2015-10-05 16:23:01 -0400
committerAndy Schwerin <schwerin@mongodb.com>2015-10-06 12:45:03 -0400
commitd9f2d8fda800fdc2cbd2be30413412c19a24f97a (patch)
treea823255d07181fc1af6fb5257c7d8e95f530f358 /jstests/gle
parenta7aa0d48c57a1ce1a82825e5bc6348f88fc10f35 (diff)
downloadmongo-d9f2d8fda800fdc2cbd2be30413412c19a24f97a.tar.gz
SERVER-20764 Adjust create_index_gle.js to eliminate race between shell and mongos.
The problem with create_index_gle.js that causes SERVER-20764 was that when the node ultimately given a slaveDelay is initially elected primary, the test does not wait for mongos to recognize the change of primary node in the shard replica set. The fix in this patch is to initialize the shard replica set with only one electable node.
Diffstat (limited to 'jstests/gle')
-rw-r--r--jstests/gle/create_index_gle.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/jstests/gle/create_index_gle.js b/jstests/gle/create_index_gle.js
index 6fb82defc4d..9b2a0185a9b 100644
--- a/jstests/gle/create_index_gle.js
+++ b/jstests/gle/create_index_gle.js
@@ -1,15 +1,23 @@
load('jstests/replsets/rslib.js');
-var st = new ShardingTest({ shards: { rs0: { nodes: 2, oplogSize: 10, verbose: 1 }}});
+(function () {
+"use strict";
+
+var st = new ShardingTest({
+ shards: {
+ rs0: {
+ nodes: { n0: {}, n1: { rsConfig: { priority: 0 } } },
+ oplogSize: 10,
+ verbose: 1,
+ }
+ },
+});
var replTest = st.rs0;
var config = replTest.getReplSetConfig();
-config.members[1].priority = 0;
// Add a delay long enough so getLastError would actually 'wait' for write concern.
config.members[1].slaveDelay = 3;
config.version = 2;
-var priConn = replTest.getPrimary();
-
reconfig(replTest, config, true);
assert.soon(function() {
@@ -38,3 +46,4 @@ assert.eq(priIdx.length, secIdx.length, 'pri: ' + tojson(priIdx) + ', sec: ' + t
st.stop();
+}());