blob: 3b4bec81551dc303de5b6586f62d6bd0268d3c76 (
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
|
// Continuation of max_time_ms.js, but only contains commands which are not present in a previous
// version
(function() {
'use strict';
var st = new ShardingTest({shards: 2});
var mongos = st.s0;
var shards = [st.shard0, st.shard1];
var coll = mongos.getCollection("foo.bar");
var admin = mongos.getDB("admin");
var cursor;
var res;
// Helper function to configure "maxTimeAlwaysTimeOut" fail point on shards, which forces mongod
// to throw if it receives an operation with a max time. See fail point declaration for
// complete description.
var configureMaxTimeAlwaysTimeOut = function(mode) {
assert.commandWorked(shards[0].getDB("admin").runCommand(
{configureFailPoint: "maxTimeAlwaysTimeOut", mode: mode}));
assert.commandWorked(shards[1].getDB("admin").runCommand(
{configureFailPoint: "maxTimeAlwaysTimeOut", mode: mode}));
};
// Positive test for "setFeatureCompatibilityVersion"
configureMaxTimeAlwaysTimeOut("alwaysOn");
assert.commandFailedWithCode(
admin.runCommand({setFeatureCompatibilityVersion: '3.4', maxTimeMS: 1000 * 60 * 60 * 24}),
ErrorCodes.ExceededTimeLimit,
"expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point");
// Negative test for "setFeatureCompatibilityVersion"
configureMaxTimeAlwaysTimeOut("off");
assert.commandWorked(
admin.runCommand({setFeatureCompatibilityVersion: '3.4', maxTimeMS: 1000 * 60 * 60 * 24}),
"expected setFeatureCompatibilityVersion to not hit time limit in mongod");
assert.commandWorked(
admin.runCommand({setFeatureCompatibilityVersion: '3.6', maxTimeMS: 1000 * 60 * 60 * 24}),
"expected setFeatureCompatibilityVersion to not hit time limit in mongod");
st.stop();
})();
|