blob: ae3280fe95319bc587c09dbd788458271ff0a133 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Check that connecting via IPv4 keeps working when
// binding to localhost and enabling IPv6.
(function() {
'use strict';
const proc = MongoRunner.runMongod({bind_ip: "localhost", "ipv6": ""});
assert.neq(proc, null);
assert.soon(function() {
try {
const uri = 'mongodb://127.0.0.1:' + proc.port + '/test';
const conn = new Mongo(uri);
assert.commandWorked(conn.adminCommand({ping: 1}));
return true;
} catch (e) {
jsTestLog('Ping failed: ' + tojson(e));
return false;
}
}, "Cannot connect to 127.0.0.1 when bound to localhost", 30 * 1000);
MongoRunner.stopMongod(proc);
})();
|