diff options
author | Tad Marshall <tad@10gen.com> | 2012-11-22 13:03:51 -0500 |
---|---|---|
committer | Tad Marshall <tad@10gen.com> | 2012-11-22 13:03:51 -0500 |
commit | 0240ea99eb415ea5b380084bb3d45e3a53c475e0 (patch) | |
tree | bac6aa97961e9b51fb8b45834cb00799ce77604a | |
parent | ae9f99dbc9eb0683147078d290d3f1b8171fe864 (diff) | |
download | mongo-0240ea99eb415ea5b380084bb3d45e3a53c475e0.tar.gz |
SERVER-7738 fix test to avoid race
Add a 10 millisecond sleep before each call to MongoRunner.stopMongod()
to reduce the probability that the server will shut down before mongos
has a chance to send the write to it.
-rw-r--r-- | jstests/sharding/gle_error_message.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/jstests/sharding/gle_error_message.js b/jstests/sharding/gle_error_message.js index 729f9f9e0b6..ae056bbb95f 100644 --- a/jstests/sharding/gle_error_message.js +++ b/jstests/sharding/gle_error_message.js @@ -45,6 +45,9 @@ jsTest.log( "Testing GLE when writeback host goes down..." ) coll.insert({ _id : -2, hello : "world" }) coll.insert({ _id : 2, hello : "world" }) +// pause to give writes time to happen +sleep(10); + MongoRunner.stopMongod( st.shard0 ) jsTest.log( "GLE : " + tojson( coll.getDB().getLastErrorObj() ) ) @@ -59,6 +62,9 @@ jsTest.log( "Testing GLE when main host goes down..." ) coll.insert({ _id : -3, hello : "world" }) coll.insert({ _id : 3, hello : "world" }) +// pause to give writes time to happen +sleep(10); + MongoRunner.stopMongod( st.shard1 ) try{ @@ -88,6 +94,9 @@ jsTest.log( "Testing multi GLE when host goes down..." ) // insert to two diff shards coll.update({ hello : "world" }, { $set : { goodbye : "world" } }, false, true) +// pause to give writes time to happen +sleep(10); + MongoRunner.stopMongod( st.shard0 ) try{ @@ -113,6 +122,9 @@ staleColl.findOne() printjson( admin.runCommand({ moveChunk : "" + coll, find : { _id : 0 }, to : shards[2]._id }) ) +// pause to give writes time to happen +sleep(10); + MongoRunner.stopMongod( st.shard2 ) jsTest.log( "Sending stale write..." ) @@ -124,4 +136,4 @@ assert.neq( null, staleColl.getDB().getLastError() ) jsTest.log( "Done!" ) -st.stop()
\ No newline at end of file +st.stop() |