summaryrefslogtreecommitdiff
path: root/jstests/auth/auth-fail-client-addr.js
blob: 426821545bcd9c673faadbd347f790bad0a22fb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Verify that client IP address is included in MONGODB-CR auth failure response

function runTest(m) {
    db = m.getDB("test");
    db.auth({user: "root", pwd: "periwinkle", mechanism: "MONGODB-CR"});

    assert.soon(function() {
        var log = cat(m.fullOptions.logFile);
        return /Failed to authenticate root@test from client 127\.0\.0\.1:\d+/.test(log);
    }, "Authentication failure message not encountered or missing client IP", 30 * 1000, 5 * 1000);
}

print("START auth-fail-client-addr.js");
runTest(MongoRunner.runMongod({useHostname: false, useLogFiles: true}));
print("SUCCESS auth-fail-client-addr.js");