summaryrefslogtreecommitdiff
path: root/jstests/replsets/replsetarb1.js
blob: a323290d4a8bfe66d26355507e2b9c9fbc6c0b6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// FAILING TEST
// no primary is ever elected if the first server is an arbiter

doTest = function( signal ) {

    var replTest = new ReplSetTest( {name: 'unicomplex', nodes: 3} );
    var nodes = replTest.nodeList();

    print(tojson(nodes));

    var conns = replTest.startSet();
    var r = replTest.initiate({"_id" : "unicomplex", 
                "members" : [
                             {"_id" : 0, "host" : nodes[0], "arbiterOnly" : true}, 
                             {"_id" : 1, "host" : nodes[1]}, 
                             {"_id" : 2, "host" : nodes[2]}]});

    // Make sure we have a master
    // Neither this
    var master = replTest.getMaster();

    // Make sure we have an arbiter
    // Nor this will succeed
    assert.soon(function() {
        res = conns[0].getDB("admin").runCommand({replSetGetStatus: 1});
        printjson(res);
        return res.myState == 7;
    }, "Aribiter failed to initialize.");

    replTest.stopSet( signal );
}

// doTest( 15 );