mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
ensure that the correct member is primary in test
This commit is contained in:
parent
8ac0b95fee
commit
d676de2512
@ -48,7 +48,7 @@ var admin = p.getDB("admin");
|
|||||||
var foo = p.getDB("foo");
|
var foo = p.getDB("foo");
|
||||||
var local = p.getDB("local");
|
var local = p.getDB("local");
|
||||||
|
|
||||||
var config = {_id : basename, members : [{_id : 0, host : hostname+":"+ports[0]}]};
|
var config = {_id : basename, members : [{_id : 0, host : hostname+":"+ports[0], priority:2}]};
|
||||||
printjson(config);
|
printjson(config);
|
||||||
var result = admin.runCommand({replSetInitiate : config});
|
var result = admin.runCommand({replSetInitiate : config});
|
||||||
print("result:");
|
print("result:");
|
||||||
@ -126,6 +126,10 @@ var startSlave = function(n) {
|
|||||||
|
|
||||||
assert.eq(status.members[n].state, 2);
|
assert.eq(status.members[n].state, 2);
|
||||||
|
|
||||||
|
assert.soon(function() {
|
||||||
|
return admin.runCommand({isMaster : 1}).ismaster;
|
||||||
|
});
|
||||||
|
|
||||||
admin.foo.insert({x:1});
|
admin.foo.insert({x:1});
|
||||||
assert.soon(function() {
|
assert.soon(function() {
|
||||||
var last = local.oplog.rs.find().sort({$natural:-1}).limit(1).next();
|
var last = local.oplog.rs.find().sort({$natural:-1}).limit(1).next();
|
||||||
|
Loading…
Reference in New Issue
Block a user