Permalink
Browse files

SERVER-6363 auth_slaveok_routing.js failing all over

Remove extraneous step in the test that can cause the connection to cache a connection that may end up becoming the new primary when the replica set enters steady state after restart.
  • Loading branch information...
1 parent ec9d17b commit c40669424e234a4a74dbe10d82ab76fa38ff0be2 @renctan renctan committed Jul 16, 2012
Showing with 7 additions and 12 deletions.
  1. +7 −12 jstests/sharding/auth_slaveok_routing.js
View
19 jstests/sharding/auth_slaveok_routing.js
@@ -6,16 +6,20 @@
/**
* Checks if a query to the given collection will be routed to the secondary.
- *
+ *
* @param {DBCollection} coll
* @param {Object} query
- *
+ *
* @return {boolean} true if query was routed to a secondary node.
*/
function doesRouteToSec( coll, query ) {
var explain = coll.find( query ).explain();
var conn = new Mongo( explain.server );
- return conn.getDB( 'admin' ).runCommand({ isMaster: 1 }).secondary;
+ var cmdRes = conn.getDB( 'admin' ).runCommand({ isMaster: 1 });
+
+ jsTest.log('isMaster: ' + tojson(cmdRes));
+
+ return cmdRes.secondary;
}
var rsOpts = { oplogSize: 10 };
@@ -74,15 +78,6 @@ replTest.awaitSecondaryNodes();
coll.setSlaveOk( true );
-try {
- assert( doesRouteToSec( coll, { v: vToFind++ }));
-} catch (x) {
- /* This is expected since the socket for the old connection we have has
- * already been closed on the other side
- */
- print( 'Exception occured (expected): ' + x );
-}
-
/* replSetMonitor does not refresh the nodes information when getting secondaries.
* A node that is previously labeled as secondary can now be a primary, so we
* wait for the replSetMonitorWatcher thread to refresh the nodes information.

0 comments on commit c406694

Please sign in to comment.