From f4c69235c352f846461c5ec11d11338114f5f3a7 Mon Sep 17 00:00:00 2001 From: William Schultz Date: Mon, 1 Oct 2018 12:34:53 -0400 Subject: [PATCH] SERVER-37274 Set priority of secondaries to zero in commands_that_accept_write_concern JS tests --- jstests/replsets/commands_that_write_accept_wc.js | 7 ++++++- .../commands_that_write_accept_wc_configRS.js | 11 +++++++++-- .../sharding/commands_that_write_accept_wc_shards.js | 11 +++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/jstests/replsets/commands_that_write_accept_wc.js b/jstests/replsets/commands_that_write_accept_wc.js index 284c9143a7e..26d785c97f7 100644 --- a/jstests/replsets/commands_that_write_accept_wc.js +++ b/jstests/replsets/commands_that_write_accept_wc.js @@ -8,7 +8,12 @@ (function() { "use strict"; - var replTest = new ReplSetTest({name: 'WCSet', nodes: 3, settings: {chainingAllowed: false}}); + var replTest = new ReplSetTest({ + name: 'WCSet', + // Set priority of secondaries to zero to prevent spurious elections. + nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}], + settings: {chainingAllowed: false} + }); replTest.startSet(); replTest.initiate(); diff --git a/jstests/sharding/commands_that_write_accept_wc_configRS.js b/jstests/sharding/commands_that_write_accept_wc_configRS.js index 9fc95563eab..aac64734c7f 100644 --- a/jstests/sharding/commands_that_write_accept_wc_configRS.js +++ b/jstests/sharding/commands_that_write_accept_wc_configRS.js @@ -21,9 +21,16 @@ load('jstests/multiVersion/libs/auth_helpers.js'); TestData.disableImplicitSessions = true; var st = new ShardingTest({ + // Set priority of secondaries to zero to prevent spurious elections. shards: { - rs0: {nodes: 3, settings: {chainingAllowed: false}}, - rs1: {nodes: 3, settings: {chainingAllowed: false}} + rs0: { + nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}], + settings: {chainingAllowed: false} + }, + rs1: { + nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}], + settings: {chainingAllowed: false} + } }, configReplSetTestOptions: {settings: {chainingAllowed: false}}, mongos: 1 diff --git a/jstests/sharding/commands_that_write_accept_wc_shards.js b/jstests/sharding/commands_that_write_accept_wc_shards.js index 2d41ef9bace..6d843652d12 100644 --- a/jstests/sharding/commands_that_write_accept_wc_shards.js +++ b/jstests/sharding/commands_that_write_accept_wc_shards.js @@ -14,9 +14,16 @@ load('jstests/libs/write_concern_util.js'); (function() { "use strict"; var st = new ShardingTest({ + // Set priority of secondaries to zero to prevent spurious elections. shards: { - rs0: {nodes: 3, settings: {chainingAllowed: false}}, - rs1: {nodes: 3, settings: {chainingAllowed: false}} + rs0: { + nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}], + settings: {chainingAllowed: false} + }, + rs1: { + nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {priority: 0}}], + settings: {chainingAllowed: false} + } }, configReplSetTestOptions: {settings: {chainingAllowed: false}}, mongos: 1,