summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/failcommand_failpoint_maxtimems.js
blob: 575f7df81cae50a99e621c4b77401938424c016a (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
(function() {
'use strict';

var conn = MongoRunner.runMongod();
var admin = conn.getDB('admin');
var db = conn.getDB('test');

var fpCmd = {
    configureFailPoint: 'failCommand',
    mode: {times: 1},
    data: {
        failCommands: ['insert'],
        blockConnection: true,
        blockTimeMS: 1000,
    },
};

assert.commandWorked(admin.runCommand(fpCmd));

var insertCmd = {
    insert: 'coll',
    documents: [{x: 1}],
    maxTimeMS: 100,
};

assert.commandFailedWithCode(db.runCommand(insertCmd), ErrorCodes.MaxTimeMSExpired);

MongoRunner.stopMongod(conn);
})();