diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-01-19 17:41:37 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-01-19 18:16:37 -0500 |
commit | 7a7efbb224163e439edfbb6eb1df47c833d814cd (patch) | |
tree | 72d01e8968eac492c12d01d3f31bfb628c36ffc9 /jstests/sharding/bulk_insert.js | |
parent | baffac716d452e0058cca9717e30a2a359f7dd46 (diff) | |
download | mongo-7a7efbb224163e439edfbb6eb1df47c833d814cd.tar.gz |
SERVER-22235 Add check for empty collection in bulk_insert.js
Diffstat (limited to 'jstests/sharding/bulk_insert.js')
-rw-r--r-- | jstests/sharding/bulk_insert.js | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/jstests/sharding/bulk_insert.js b/jstests/sharding/bulk_insert.js index 015c8bc3aa6..1863141d020 100644 --- a/jstests/sharding/bulk_insert.js +++ b/jstests/sharding/bulk_insert.js @@ -49,10 +49,9 @@ var resetColls = function() { assert.writeOK(collDi.remove({})); }; -var isDupKeyError = function(err) -{ +var isDupKeyError = function(err) { return /dup key/.test(err + ""); -} +}; jsTest.log("Collections created."); st.printShardingStatus(); @@ -255,7 +254,7 @@ var inserts = [{ukey : 0}, {ukey : -3}, {hello : "world"}, {ukey : 4}, - {ukey : 4}] + {ukey : 4}]; // Last error here is mongos error res = assert.writeError(collSh.insert(inserts, 1)); @@ -276,14 +275,14 @@ assert.eq(6, collDi.find().itcount()); // jsTest.log("Testing bulk insert (no COE) with WBL..."); - resetColls(); + var inserts = [{ukey : 1}, {ukey : -1}]; var staleCollSh = staleMongos.getCollection(collSh + ""); +assert.eq(null, staleCollSh.findOne(), 'Collections should be empty'); -staleCollSh.findOne(); assert.commandWorked(admin.runCommand({ moveChunk : collSh + "", find : {ukey : 0}, to : shards[1]._id, @@ -301,28 +300,17 @@ assert.writeOK(staleCollSh.insert(inserts)); // jsTest.log("Testing bulk insert (no COE) with WBL and large objects...") - -var data1MB = "x"; -while (data1MB.length < 1024 * 1024) - data1MB += data1MB; - -var data10MB = ""; -for (var i = 0; i < 10; i++) - data10MB += data1MB; - resetColls(); -var inserts = [{ukey : 1, - data : data10MB}, - {ukey : 2, - data : data10MB}, - {ukey : -1, - data : data10MB}, - {ukey : -2, - data : data10MB}] + +var data10MB = 'x'.repeat(10 * 1024 * 1024); +var inserts = [{ukey : 1, data : data10MB}, + {ukey : 2, data : data10MB}, + {ukey : -1, data : data10MB}, + {ukey : -2, data : data10MB}]; staleCollSh = staleMongos.getCollection(collSh + ""); +assert.eq(null, staleCollSh.findOne(), 'Collections should be empty'); -staleCollSh.findOne(); assert.commandWorked(admin.runCommand({ moveChunk : collSh + "", find : {ukey : 0}, to : shards[1]._id, |