From 62fec3e663bf160aafc7663bb5b35a28da314fc2 Mon Sep 17 00:00:00 2001 From: Greg Studer Date: Mon, 13 May 2013 19:04:53 -0400 Subject: SERVER-9041 try num 2, disable inapplicable tests for win32 --- jstests/sharding/shard_kill_and_pooling.js | 113 ++++++++++++++++------------- 1 file changed, 64 insertions(+), 49 deletions(-) (limited to 'jstests/sharding/shard_kill_and_pooling.js') diff --git a/jstests/sharding/shard_kill_and_pooling.js b/jstests/sharding/shard_kill_and_pooling.js index cbb160020ab..e9a7e618728 100644 --- a/jstests/sharding/shard_kill_and_pooling.js +++ b/jstests/sharding/shard_kill_and_pooling.js @@ -16,60 +16,75 @@ st.stopBalancer(); var mongos = st.s0; var coll = mongos.getCollection("foo.bar"); +var db = coll.getDB(); -coll.insert({ hello : "world" }) -assert.eq( null, coll.getDB().getLastError() ); +//Test is not valid for Win32 +var is32Bits = ( db.serverBuildInfo().bits == 32 ); +if ( is32Bits && _isWindows() ) { -jsTest.log("Creating new connections..."); + // Win32 doesn't provide the polling interface we need to implement the check tested here + jsTest.log( "Test is not valid on Win32 platform." ); -// Create a bunch of connections to the primary node through mongos. -// jstest ->(x10)-> mongos ->(x10)-> primary -var conns = []; -for ( var i = 0; i < 50; i++) { - conns.push(new Mongo(mongos.host)); - assert.neq( null, conns[i].getCollection(coll + "").findOne() ); } - -jsTest.log("Returning the connections back to the pool."); - -for ( var i = 0; i < conns.length; i++ ) { - conns[i] = null; -} -// Make sure we return connections back to the pool -gc(); - -// Don't make test fragile by linking to format of shardConnPoolStats, but this is useful if -// something goes wrong. -var connPoolStats = mongos.getDB("admin").runCommand({ shardConnPoolStats : 1 }); -printjson( connPoolStats ); - -jsTest.log("Shutdown shard " + (killWith == 9 ? "uncleanly" : "" ) + "..."); - -MongoRunner.stopMongod( st.shard0, killWith ); - -jsTest.log("Restart shard..."); - -st.shard0 = MongoRunner.runMongod({ restart : st.shard0, forceLock : true }); - -jsTest.log("Waiting for socket timeout time..."); - -// Need to wait longer than the socket polling time. -sleep(2 * 5000); - -jsTest.log("Run queries using new connections."); - -var numErrors = 0; -for ( var i = 0; i < conns.length; i++) { - var newConn = new Mongo(mongos.host); - try { - assert.neq( null, newConn.getCollection("foo.bar").findOne() ); - } catch (e) { - printjson(e); - numErrors++; +else { + + // Non-Win32 platform + + coll.insert({ hello : "world" }) + assert.eq( null, coll.getDB().getLastError() ); + + jsTest.log("Creating new connections..."); + + // Create a bunch of connections to the primary node through mongos. + // jstest ->(x10)-> mongos ->(x10)-> primary + var conns = []; + for ( var i = 0; i < 50; i++) { + conns.push(new Mongo(mongos.host)); + assert.neq( null, conns[i].getCollection(coll + "").findOne() ); } -} + + jsTest.log("Returning the connections back to the pool."); + + for ( var i = 0; i < conns.length; i++ ) { + conns[i] = null; + } + // Make sure we return connections back to the pool + gc(); + + // Don't make test fragile by linking to format of shardConnPoolStats, but this is useful if + // something goes wrong. + var connPoolStats = mongos.getDB("admin").runCommand({ shardConnPoolStats : 1 }); + printjson( connPoolStats ); + + jsTest.log("Shutdown shard " + (killWith == 9 ? "uncleanly" : "" ) + "..."); + + MongoRunner.stopMongod( st.shard0, killWith ); + + jsTest.log("Restart shard..."); + + st.shard0 = MongoRunner.runMongod({ restart : st.shard0, forceLock : true }); + + jsTest.log("Waiting for socket timeout time..."); + + // Need to wait longer than the socket polling time. + sleep(2 * 5000); + + jsTest.log("Run queries using new connections."); + + var numErrors = 0; + for ( var i = 0; i < conns.length; i++) { + var newConn = new Mongo(mongos.host); + try { + assert.neq( null, newConn.getCollection("foo.bar").findOne() ); + } catch (e) { + printjson(e); + numErrors++; + } + } + + assert.eq(0, numErrors); -assert.eq(0, numErrors); +} // End Win32 check st.stop(); @@ -77,4 +92,4 @@ jsTest.log("DONE test " + test); } // End test loop -jsTest.log("DONE!"); \ No newline at end of file +jsTest.log("DONE!"); -- cgit v1.2.1