2014-10-13 21:56:51 +02:00
|
|
|
/*
|
|
|
|
* Test that replSetInitiate prohibits w:0 in getLastErrorDefaults,
|
|
|
|
* SERVER-13055.
|
2019-11-07 23:37:42 +01:00
|
|
|
* @tags: [multiversion_incompatible]
|
2014-10-13 21:56:51 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
var InvalidReplicaSetConfig = 93;
|
|
|
|
|
|
|
|
var replTest = new ReplSetTest({name: 'prohibit_w0', nodes: 1});
|
|
|
|
var nodes = replTest.nodeList();
|
|
|
|
var conns = replTest.startSet();
|
|
|
|
var admin = conns[0].getDB("admin");
|
|
|
|
|
|
|
|
function testInitiate(gleDefaults) {
|
|
|
|
var conf = replTest.getReplSetConfig();
|
|
|
|
jsTestLog('conf');
|
|
|
|
printjson(conf);
|
|
|
|
conf.settings = gleDefaults;
|
|
|
|
|
|
|
|
var response = admin.runCommand({replSetInitiate: conf});
|
|
|
|
assert.commandFailedWithCode(response, InvalidReplicaSetConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Try to initiate with w: 0 in getLastErrorDefaults.
|
|
|
|
*/
|
2016-03-09 18:17:50 +01:00
|
|
|
testInitiate({getLastErrorDefaults: {w: 0}});
|
2014-10-13 21:56:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Try to initiate with w: 0 and other options in getLastErrorDefaults.
|
|
|
|
*/
|
2016-03-09 18:17:50 +01:00
|
|
|
testInitiate({getLastErrorDefaults: {w: 0, j: false, wtimeout: 100, fsync: true}});
|
2014-10-13 21:56:51 +02:00
|
|
|
|
|
|
|
replTest.stopSet();
|