summaryrefslogtreecommitdiff
path: root/jstests/slowNightly/replReads.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/slowNightly/replReads.js')
-rw-r--r--jstests/slowNightly/replReads.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/jstests/slowNightly/replReads.js b/jstests/slowNightly/replReads.js
index 4fe9130..dadc2c6 100644
--- a/jstests/slowNightly/replReads.js
+++ b/jstests/slowNightly/replReads.js
@@ -43,6 +43,8 @@ function testReadLoadBalancing(numReplicas) {
assert.soon( function(){ return secondaries[i].getDB("test").foo.count() > 0; } )
secondaries[i].getDB('test').setProfilingLevel(2)
}
+ // Primary may change with reconfig
+ primary.getDB('test').setProfilingLevel(2)
for (var i = 0; i < secondaries.length * 10; i++) {
conn = new Mongo(s._mongos[0].host)
@@ -75,13 +77,21 @@ function testReadLoadBalancing(numReplicas) {
var x = rsStats();
printjson(x);
var numOk = 0;
+ // Now wait until the host disappears, since now we actually update our
+ // replica sets via isMaster in mongos
+ if( x.hosts.length == rs.conf()["members"].length - 1 ) return true
+ /*
for ( var i=0; i<x.hosts.length; i++ )
if ( x.hosts[i].hidden )
return true;
+ */
return false;
} , "one slave not ok" , 180000 , 5000
);
-
+
+ // Secondaries may change here
+ secondaries = s._rs[0].test.liveNodes.slaves
+
for (var i = 0; i < secondaries.length * 10; i++) {
conn = new Mongo(s._mongos[0].host)
conn.setSlaveOk()
@@ -95,7 +105,7 @@ function testReadLoadBalancing(numReplicas) {
}
counts = counts.sort();
- assert.eq( 20 , counts[1] - counts[0] , "counts wrong: " + tojson( counts ) );
+ assert.eq( 20 , Math.abs( counts[1] - counts[0] ), "counts wrong: " + tojson( counts ) );
s.stop()
}