jstests/replsets/txn_override_unittests.js
/**
 * Marks that the given command should fail with the given parameters using the failCommand
 * failpoint. This does not break up a currently active transaction in the override function.
 * This does override previous uses of the failpoint, however.
 */
Marks that the given command should fail with the given parameters using the failCommand
failpoint. This does not break up a currently active transaction in the override function.
This does override previous uses of the failpoint, however.
Marks that the given command should fail with the given parameters using the failCommand failpoint . This does not break up a currently active transaction in the override function . This does override previous uses of the failpoint however .
function failCommandWithFailPoint(commandsToFail, {
    errorCode: errorCode,
    closeConnection: closeConnection = false,
    writeConcernError: writeConcernError,
    mode: mode = {
        times: 1
    },
} = {}) {
    assert(!(writeConcernError && errorCode),
           "Cannot specify both a WCE " + tojsononeline(writeConcernError) + " and an error code " +
               errorCode);
    let data = {
        failCommands: commandsToFail,
    };
    if (errorCode) {
        data["errorCode"] = errorCode;
    }
    if (closeConnection) {
        data["closeConnection"] = closeConnection;
    }
    if (writeConcernError) {
        data["writeConcernError"] = writeConcernError;
    }
    assert.commandWorked(mongoRunCommandOriginal.apply(
        failpointConn, ['admin', {configureFailPoint: "failCommand", mode: mode, data: data}, 0]));
}
function failCommandWithFailPoint ( commandsToFail , { errorCode : errorCode , closeConnection : closeConnection = false , writeConcernError : writeConcernError , mode : mode = { times : 1 } , } = { } ) { assert ( ! ( writeConcernError && errorCode ) , "Cannot specify both a WCE " + tojsononeline ( writeConcernError ) + " and an error code " + errorCode ) ; let data = { failCommands : commandsToFail , } ; if ( errorCode ) { data [ "errorCode" ] = errorCode ; } if ( closeConnection ) { data [ "closeConnection" ] = closeConnection ; } if ( writeConcernError ) { data [ "writeConcernError" ] = writeConcernError ; } assert . commandWorked ( mongoRunCommandOriginal . apply ( failpointConn , [ 'admin' , { configureFailPoint : "failCommand" , mode : mode , data : data } , 0 ] ) ) ; }
Marks that the given command should fail with the given parameters using the failCommand
 failpoint.
Marks that the given command should fail with the given parameters using the failCommand failpoint .
// By default only fail the next request of the given command. // The fail point will ignore the WCE if an error code is specified.