Skip to content

Commit

Permalink
make auth test reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Nov 1, 2011
1 parent 975be96 commit 8974668
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions jstests/sharding/auth.js
Expand Up @@ -146,13 +146,17 @@ for (i=0; i<num; i++) {
s.getDB("test").foo.insert({x:i, abc : "defg", date : new Date(), str : "all the talk on the market"});
}

var d1Chunks = s.getDB("config").chunks.count({shard : "d1"});
var d2Chunks = s.getDB("config").chunks.count({shard : "d2"});
var totalChunks = s.getDB("config").chunks.count({ns : "test.foo"});
assert.soon( function(){

print("chunks: " + d1Chunks+" "+d2Chunks+" "+totalChunks);
var d1Chunks = s.getDB("config").chunks.count({shard : "d1"});
var d2Chunks = s.getDB("config").chunks.count({shard : "d2"});
var totalChunks = s.getDB("config").chunks.count({ns : "test.foo"});

assert(d1Chunks > 0 && d2Chunks > 0 && d1Chunks+d2Chunks == totalChunks);
print("chunks: " + d1Chunks+" "+d2Chunks+" "+totalChunks);

return d1Chunks > 0 && d2Chunks > 0 && d1Chunks+d2Chunks == totalChunks;
}
)

assert.eq(s.getDB("test").foo.count(), num+1);

Expand Down

0 comments on commit 8974668

Please sign in to comment.