summaryrefslogtreecommitdiff
path: root/jstests/replsets/localhost3.js
blob: ed3238a9d0468fe36d5cc25124e664a96398c6df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Test ReplSet default initiate with localhost-only binding

(function() {
    'use strict';

    // Select localhost when binding to localhost
    const rt = new ReplSetTest({name: "rsLocal", nodes: 2});
    const primary = rt.startSet({bind_ip: undefined})[0];
    const db = primary.getDB('admin');
    const resp = assert.commandWorked(db.adminCommand({replSetInitiate: undefined}));
    assert(resp.me.startsWith('localhost:'), tojson(resp.me) + " should start with localhost:");
    rt.stopSet();
})();