Skip to content

Commit

Permalink
Fix test to wait for the master's POV to catch up
Browse files Browse the repository at this point in the history
  • Loading branch information
kchodorow committed Aug 7, 2012
1 parent aec02b6 commit 32475f5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions jstests/replsets/stepdown.js
Expand Up @@ -108,13 +108,26 @@ catch (e) {
print(e);
}

print("\nsleeping");

sleep(2000);
master = replTest.getMaster();
assert.soon(function() {
var result = master.getDB("admin").runCommand({replSetGetStatus:1});
for (var i in result.members) {
if (result.members[i].self) {
continue;
}

return result.members[i].health == 0;
}

}, 'make sure master knows that slave is down before proceeding');


print("\nrunning shutdown without force on master: "+master);

result = replTest.getMaster().getDB("admin").runCommand({shutdown : 1, timeoutSecs : 3});
// this should fail because the master can't reach an up-to-date secondary (because the only
// secondary is down)
result = master.getDB("admin").runCommand({shutdown : 1, timeoutSecs : 3});
assert.eq(result.ok, 0);

print("\nsend shutdown command");
Expand Down

0 comments on commit 32475f5

Please sign in to comment.