blob: 54ae36b8e0db070f67b35d900408a64a74b14b44 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/**
* Tests the rewrite of NetworkInterfaceExceededTimeLimit exception coming from
* `executor/connection_pool.cpp` into MaxTimeMSError when MaxTimeMS option is set for a given
* sharding command.
*
* @tags: [
* requires_fcv_61,
* does_not_support_stepdowns,
* ]
*/
(function() {
"use strict";
load("jstests/libs/fail_point_util.js");
const databaseName = "my-database";
const collectionName = "my-collection";
function generateInsertCommand(maxTimeMS) {
return {insert: collectionName, documents: [{}], maxTimeMS: maxTimeMS};
}
const st = new ShardingTest({shards: 1, mongos: 1});
const database = st.s0.getDB(databaseName);
const collection = database.getCollection(collectionName);
const session = database.getMongo().startSession({causalConsistency: false});
assert.commandWorked(
database.runCommand({create: collection.getName(), writeConcern: {w: "majority"}}));
assert.commandWorked(database.runCommand(generateInsertCommand(1000)));
const failpoint =
configureFailPoint(st.s, "forceExecutorConnectionPoolTimeout", {"timeout": 1000}, "alwaysOn");
assert.commandFailedWithCode(database.runCommand(generateInsertCommand(1)),
ErrorCodes.MaxTimeMSExpired);
assert.commandFailedWithCode(database.runCommand(generateInsertCommand(30000)),
ErrorCodes.NetworkInterfaceExceededTimeLimit);
failpoint.off();
st.stop();
}());
|