jstests/libs/all_commands_test.js
/**
     * Verifies that the command map contains an entry for every command that exists on the server.
     * This is already called in 'testAllCommands', so there is no need to call this directly.
     *
     * @param {Object} conn The shell connection to run the suite over.
     * @param {map} cmdMap A map of all commands, with their invocations and expected behavior.
     */
Verifies that the command map contains an entry for every command that exists on the server.
This is already called in 'testAllCommands', so there is no need to call this directly.

@param {Object} conn The shell connection to run the suite over.
@param {map} cmdMap A map of all commands, with their invocations and expected behavior.
Verifies that the command map contains an entry for every command that exists on the server . This is already called in ' testAllCommands ' so there is no need to call this directly . @param { Object } conn The shell connection to run the suite over . @param { map } cmdMap A map of all commands with their invocations and expected behavior .
function checkCommandCoverage(conn, cmdMap) {
        const res = assert.commandWorked(conn.adminCommand({listCommands: 1}));
        const commandsInListCommands = Object.keys(res.commands);
        let missingCommands = [];
        for (const command of commandsInListCommands) {
            if (!cmdMap[command]) {
                missingCommands.push(command);
            }
        }
        if (missingCommands.length !== 0) {
            throw new Error("Command map is missing entries for " + missingCommands);
        }
        return commandsInListCommands;
    }
function checkCommandCoverage ( conn , cmdMap ) { const res = assert . commandWorked ( conn . adminCommand ( { listCommands : 1 } ) ) ; const commandsInListCommands = Object . keys ( res . commands ) ; let missingCommands = [ ] ; for ( const command of commandsInListCommands ) { if ( ! cmdMap [ command ] ) { missingCommands . push ( command ) ; } } if ( missingCommands . length !== 0 ) { throw new Error ( "Command map is missing entries for " + missingCommands ) ; } return commandsInListCommands ; }
Verifies that the command map contains an entry for every command that exists on the server.
Verifies that the command map contains an entry for every command that exists on the server .
// Make sure that all valid commands are covered in the cmdMap.