diff options
| author | Randolph Tan <randolph@10gen.com> | 2014-05-14 14:11:11 -0400 |
|---|---|---|
| committer | Randolph Tan <randolph@10gen.com> | 2014-05-15 14:04:11 -0400 |
| commit | 0dabee8227d445a18fa5e8e49b2be60ba2a0beef (patch) | |
| tree | 5cd9058a4483202c2f7e2ab6f5c44079a74ac157 /jstests/sharding/multi_write_target.js | |
| parent | 4de88387eec6c0bb08b10d0ba1574a656f56232d (diff) | |
| download | mongo-0dabee8227d445a18fa5e8e49b2be60ba2a0beef.tar.gz | |
SERVER-13741 Migrate remaining tests to use write commands
Diffstat (limited to 'jstests/sharding/multi_write_target.js')
| -rw-r--r-- | jstests/sharding/multi_write_target.js | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/jstests/sharding/multi_write_target.js b/jstests/sharding/multi_write_target.js index 52ce36a83e0..3fc528293c8 100644 --- a/jstests/sharding/multi_write_target.js +++ b/jstests/sharding/multi_write_target.js @@ -25,20 +25,15 @@ st.printShardingStatus(); jsTest.log("Testing multi-update..."); // Put data on all shards -st.shard0.getCollection(coll.toString()).insert({ _id : 0, skey : -1, x : 1 }); -assert.gleOK(st.shard0.getCollection(coll.toString()).getDB().getLastErrorObj()); -st.shard1.getCollection(coll.toString()).insert({ _id : 1, skey : 1, x : 1 }); -assert.gleOK(st.shard1.getCollection(coll.toString()).getDB().getLastErrorObj()); +assert.writeOK(st.shard0.getCollection(coll.toString()).insert({ _id : 0, skey : -1, x : 1 })); +assert.writeOK(st.shard1.getCollection(coll.toString()).insert({ _id : 1, skey : 1, x : 1 })); // Data not in chunks -st.shard2.getCollection(coll.toString()).insert({ _id : 0, x : 1 }); -assert.gleOK(st.shard2.getCollection(coll.toString()).getDB().getLastErrorObj()); +assert.writeOK(st.shard2.getCollection(coll.toString()).insert({ _id : 0, x : 1 })); // Non-multi-update doesn't work without shard key -coll.update({ x : 1 }, { $set : { updated : true } }, { multi : false }); -assert.gleError(coll.getDB().getLastErrorObj()); +assert.writeError(coll.update({ x : 1 }, { $set : { updated : true } }, { multi : false })); -coll.update({ x : 1 }, { $set : { updated : true } }, { multi : true }); -assert.gleOK(coll.getDB().getLastErrorObj()); +assert.writeOK(coll.update({ x : 1 }, { $set : { updated : true } }, { multi : true })); // Ensure update goes to *all* shards assert.neq(null, st.shard0.getCollection(coll.toString()).findOne({ updated : true })); @@ -46,8 +41,7 @@ assert.neq(null, st.shard1.getCollection(coll.toString()).findOne({ updated : tr assert.neq(null, st.shard2.getCollection(coll.toString()).findOne({ updated : true })); // _id update works, and goes to all shards -coll.update({ _id : 0 }, { $set : { updatedById : true } }, { multi : false }); -assert.gleOK(coll.getDB().getLastErrorObj()); +assert.writeOK(coll.update({ _id : 0 }, { $set : { updatedById : true } }, { multi : false })); // Ensure _id update goes to *all* shards assert.neq(null, st.shard0.getCollection(coll.toString()).findOne({ updatedById : true })); @@ -56,11 +50,9 @@ assert.neq(null, st.shard2.getCollection(coll.toString()).findOne({ updatedById jsTest.log("Testing multi-delete..."); // non-multi-delete doesn't work without shard key -coll.remove({ x : 1 }, { justOne : true }); -assert.gleError(coll.getDB().getLastErrorObj()); +assert.writeError(coll.remove({ x : 1 }, { justOne : true })); -coll.remove({ x : 1 }, { justOne : false }); -assert.gleOK(coll.getDB().getLastErrorObj()); +assert.writeOK(coll.remove({ x : 1 }, { justOne : false })); // Ensure delete goes to *all* shards assert.eq(null, st.shard0.getCollection(coll.toString()).findOne({ x : 1 })); @@ -68,16 +60,12 @@ assert.eq(null, st.shard1.getCollection(coll.toString()).findOne({ x : 1 })); assert.eq(null, st.shard2.getCollection(coll.toString()).findOne({ x : 1 })); // Put more on all shards -st.shard0.getCollection(coll.toString()).insert({ _id : 0, skey : -1, x : 1 }); -assert.gleOK(st.shard0.getCollection(coll.toString()).getDB().getLastErrorObj()); -st.shard1.getCollection(coll.toString()).insert({ _id : 1, skey : 1, x : 1 }); -assert.gleOK(st.shard1.getCollection(coll.toString()).getDB().getLastErrorObj()); +assert.writeOK(st.shard0.getCollection(coll.toString()).insert({ _id : 0, skey : -1, x : 1 })); +assert.writeOK(st.shard1.getCollection(coll.toString()).insert({ _id : 1, skey : 1, x : 1 })); // Data not in chunks -st.shard2.getCollection(coll.toString()).insert({ _id : 0, x : 1 }); -assert.gleOK(st.shard2.getCollection(coll.toString()).getDB().getLastErrorObj()); +assert.writeOK(st.shard2.getCollection(coll.toString()).insert({ _id : 0, x : 1 })); -coll.remove({ _id : 0 }, { justOne : true }); -assert.gleOK(coll.getDB().getLastErrorObj()); +assert.writeOK(coll.remove({ _id : 0 }, { justOne : true })); // Ensure _id delete goes to *all* shards assert.eq(null, st.shard0.getCollection(coll.toString()).findOne({ x : 1 })); |
