diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-06-14 17:42:08 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-06-15 16:34:56 -0400 |
commit | 0aff7dc5e6a82de2bf41756e6bb8586c9ea0eeb3 (patch) | |
tree | 30aa09bcdd21de7c8cb6d96c19ff0a9087a2215e /jstests/sharding/write_cmd_auto_split.js | |
parent | 207dbd2324a643d12729f2060aa59f64e0de52fb (diff) | |
download | mongo-0aff7dc5e6a82de2bf41756e6bb8586c9ea0eeb3.tar.gz |
SERVER-24576 Increase the default findHost timeout
Diffstat (limited to 'jstests/sharding/write_cmd_auto_split.js')
-rw-r--r-- | jstests/sharding/write_cmd_auto_split.js | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/jstests/sharding/write_cmd_auto_split.js b/jstests/sharding/write_cmd_auto_split.js index 110fa7ddd9f..0b340148787 100644 --- a/jstests/sharding/write_cmd_auto_split.js +++ b/jstests/sharding/write_cmd_auto_split.js @@ -20,14 +20,12 @@ // Note: Estimated 'chunk size' tracked by mongos is initialized with a random value so // we are going to be conservative. for (var x = 0; x < 3100; x++) { - var res = testDB.runCommand({ + assert.writeOK(testDB.runCommand({ insert: 'insert', documents: [{x: x, v: doc1k}], ordered: false, writeConcern: {w: 1} - }); - - assert(res.ok, 'insert failed: ' + tojson(res)); + })); } // Inserted batch is a multiple of the chunkSize, expect the chunks to split into @@ -37,20 +35,18 @@ jsTest.log('Test single batch update should auto-split'); - configDB.adminCommand({enableSharding: 'test'}); - configDB.adminCommand({shardCollection: 'test.update', key: {x: 1}}); + assert.commandWorked(configDB.adminCommand({enableSharding: 'test'})); + assert.commandWorked(configDB.adminCommand({shardCollection: 'test.update', key: {x: 1}})); assert.eq(1, configDB.chunks.find().itcount()); for (var x = 0; x < 1100; x++) { - var res = testDB.runCommand({ + assert.writeOK(testDB.runCommand({ update: 'update', updates: [{q: {x: x}, u: {x: x, v: doc1k}, upsert: true}], ordered: false, writeConcern: {w: 1} - }); - - assert(res.ok, 'update failed: ' + tojson(res)); + })); } assert.gt(configDB.chunks.find().itcount(), 1); @@ -58,20 +54,18 @@ jsTest.log('Test single delete should not auto-split'); - configDB.adminCommand({enableSharding: 'test'}); - configDB.adminCommand({shardCollection: 'test.delete', key: {x: 1}}); + assert.commandWorked(configDB.adminCommand({enableSharding: 'test'})); + assert.commandWorked(configDB.adminCommand({shardCollection: 'test.delete', key: {x: 1}})); assert.eq(1, configDB.chunks.find().itcount()); for (var x = 0; x < 1100; x++) { - var res = testDB.runCommand({ + assert.writeOK(testDB.runCommand({ delete: 'delete', deletes: [{q: {x: x, v: doc1k}, limit: NumberInt(0)}], ordered: false, writeConcern: {w: 1} - }); - - assert(res.ok, 'delete failed: ' + tojson(res)); + })); } assert.eq(1, configDB.chunks.find().itcount()); @@ -79,8 +73,8 @@ jsTest.log('Test batched insert should auto-split'); - configDB.adminCommand({enableSharding: 'test'}); - configDB.adminCommand({shardCollection: 'test.insert', key: {x: 1}}); + assert.commandWorked(configDB.adminCommand({enableSharding: 'test'})); + assert.commandWorked(configDB.adminCommand({shardCollection: 'test.insert', key: {x: 1}})); assert.eq(1, configDB.chunks.find().itcount()); @@ -93,10 +87,8 @@ docs.push({x: (x + y), v: doc1k}); } - var res = testDB.runCommand( - {insert: 'insert', documents: docs, ordered: false, writeConcern: {w: 1}}); - - assert(res.ok, 'insert failed: ' + tojson(res)); + assert.writeOK(testDB.runCommand( + {insert: 'insert', documents: docs, ordered: false, writeConcern: {w: 1}})); } assert.gt(configDB.chunks.find().itcount(), 1); @@ -104,8 +96,8 @@ jsTest.log('Test batched update should auto-split'); - configDB.adminCommand({enableSharding: 'test'}); - configDB.adminCommand({shardCollection: 'test.update', key: {x: 1}}); + assert.commandWorked(configDB.adminCommand({enableSharding: 'test'})); + assert.commandWorked(configDB.adminCommand({shardCollection: 'test.update', key: {x: 1}})); assert.eq(1, configDB.chunks.find().itcount()); @@ -117,10 +109,8 @@ docs.push({q: {x: id}, u: {x: id, v: doc1k}, upsert: true}); } - var res = testDB.runCommand( - {update: 'update', updates: docs, ordered: false, writeConcern: {w: 1}}); - - assert(res.ok, 'update failed: ' + tojson(res)); + assert.writeOK(testDB.runCommand( + {update: 'update', updates: docs, ordered: false, writeConcern: {w: 1}})); } assert.gt(configDB.chunks.find().itcount(), 1); @@ -128,8 +118,8 @@ jsTest.log('Test batched delete should not auto-split'); - configDB.adminCommand({enableSharding: 'test'}); - configDB.adminCommand({shardCollection: 'test.delete', key: {x: 1}}); + assert.commandWorked(configDB.adminCommand({enableSharding: 'test'})); + assert.commandWorked(configDB.adminCommand({shardCollection: 'test.delete', key: {x: 1}})); assert.eq(1, configDB.chunks.find().itcount()); @@ -141,18 +131,15 @@ docs.push({q: {x: id, v: doc1k}, top: 0}); } - var res = testDB.runCommand({ + assert.writeOK(testDB.runCommand({ delete: 'delete', deletes: [{q: {x: x, v: doc1k}, limit: NumberInt(0)}], ordered: false, writeConcern: {w: 1} - }); - - assert(res.ok, 'delete failed: ' + tojson(res)); + })); } assert.eq(1, configDB.chunks.find().itcount()); st.stop(); - })(); |