jstests/replsets/dbcheck.js
// Now, test some unusual cases where the command should fail.
Now, test some unusual cases where the command should fail.
Now test some unusual cases where the command should fail .
function testErrorOnNonexistent() {
    let primary = replSet.getPrimary();
    let db = primary.getDB("this-probably-doesnt-exist");
    assert.commandFailed(db.runCommand({dbCheck: 1}),
                         "dbCheck spuriously succeeded on nonexistent database");
    db = primary.getDB(dbName);
    assert.commandFailed(db.runCommand({dbCheck: "this-also-probably-doesnt-exist"}),
                         "dbCheck spuriously succeeded on nonexistent collection");
}
function testErrorOnNonexistent ( ) { let primary = replSet . getPrimary ( ) ; let db = primary . getDB ( "this-probably-doesnt-exist" ) ; assert . commandFailed ( db . runCommand ( { dbCheck : 1 } ) , "dbCheck spuriously succeeded on nonexistent database" ) ; db = primary . getDB ( dbName ) ; assert . commandFailed ( db . runCommand ( { dbCheck : "this-also-probably-doesnt-exist" } ) , "dbCheck spuriously succeeded on nonexistent collection" ) ; }
Now, test some unusual cases where the command should fail.
Now test some unusual cases where the command should fail .