blob: 3beef1ed578dfbe009f6d026b0387b5f89a36031 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/**
* Test that the server rejects extremely large values for write concern wtimeout.
*/
(function() {
"use strict";
const rst = new ReplSetTest({name: jsTestName(), nodes: 2});
rst.startSet();
rst.initiateWithHighElectionTimeout();
const dbName = "testdb";
const collName = "testcoll";
const primary = rst.getPrimary();
const primaryDB = primary.getDB(dbName);
const primaryColl = primaryDB.getCollection(collName);
jsTestLog("Issuing a write within accepted wtimeout bounds");
assert.commandWorked(
primaryColl.insert({a: 1}, {writeConcern: {w: 2, wtimeout: ReplSetTest.kDefaultTimeoutMS}}));
jsTestLog("Issuing a high wtimeout write and confirming that it gets rejected");
// Outside int32 bounds.
const oneTrillionMS = 1000 * 1000 * 1000 * 1000;
assert.commandFailedWithCode(
primaryColl.insert({b: 2}, {writeConcern: {w: 2, wtimeout: oneTrillionMS}}),
ErrorCodes.FailedToParse);
rst.stopSet();
})();
|