blob: 44ef7c61fdf9c654e064e6820784794abe30566a (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
doTest = function( signal ) {
// Test add node
var replTest = new ReplSetTest( {name: 'testSet', nodes: 0, host:"localhost"} );
var first = replTest.add();
// Initiate replica set
assert.soon(function() {
var res = first.getDB("admin").runCommand({replSetInitiate: {
_id : 'testSet',
members : [{_id : 0, host : "localhost:"+replTest.ports[0]}]
}
});
return res['ok'] == 1;
});
// Get status
assert.soon(function() {
var result = first.getDB("admin").runCommand({replSetGetStatus: true});
return result['ok'] == 1;
});
replTest.getMaster();
// Start a second node
var second = replTest.add();
// Add the second node.
// This runs the equivalent of rs.add(newNode);
print("calling add again");
try {
replTest.reInitiate();
}
catch(e) {
print(e);
}
print("try to change to localhost to "+getHostName());
var master = replTest.getMaster();
var config = master.getDB("local").system.replset.findOne();
config.version++;
config.members.forEach(function(m) {
m.host = m.host.replace("localhost", getHostName());
print(m.host);
});
printjson(config);
print("trying reconfig that shouldn't work");
var result = master.getDB("admin").runCommand({replSetReconfig: config});
assert.eq(result.ok, 0);
assert.eq(result.assertionCode, 13645);
replTest.stopSet( signal );
}
doTest( 15 );
|