diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2014-10-13 15:56:51 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-10-31 09:46:53 -0400 |
commit | 1b516e4defb1dc7115d96e6936684610246eb470 (patch) | |
tree | 88d547ba3a7b13d753fdfafbe3a5d52d4e05ec4f /jstests/replsets/initiate_prohibits_w0.js | |
parent | fd316bf9977f0109c288e3d8b298b9c6ac62bc70 (diff) | |
download | mongo-1b516e4defb1dc7115d96e6936684610246eb470.tar.gz |
SERVER-15623 Test that w:0 is prohibited in getLastErrorDefaults.
Closes #847
Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'jstests/replsets/initiate_prohibits_w0.js')
-rw-r--r-- | jstests/replsets/initiate_prohibits_w0.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/replsets/initiate_prohibits_w0.js b/jstests/replsets/initiate_prohibits_w0.js new file mode 100644 index 00000000000..9bd5d4a599d --- /dev/null +++ b/jstests/replsets/initiate_prohibits_w0.js @@ -0,0 +1,35 @@ +/* + * Test that replSetInitiate prohibits w:0 in getLastErrorDefaults, + * SERVER-13055. + */ + +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. + */ +testInitiate({ + getLastErrorDefaults: {w: 0}}); + +/* + * Try to initiate with w: 0 and other options in getLastErrorDefaults. + */ +testInitiate({ + getLastErrorDefaults: {w: 0, j: false, wtimeout: 100, fsync: true}}); + +replTest.stopSet(); |