diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-04-14 15:41:16 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-04-14 17:58:36 -0400 |
commit | 8fc79125bb85c8939bd6aa4050fec29de79399d5 (patch) | |
tree | e23f071808917dd8281a14bd2c4f02acb0509a62 /jstests/sharding/shard_keycount.js | |
parent | 6e18b2fb457b93d6d6d37ea3b8c470aa8dcc8817 (diff) | |
download | mongo-8fc79125bb85c8939bd6aa4050fec29de79399d5.tar.gz |
SERVER-23704 Make shard_keycount.js invoke the anonymous test function
Diffstat (limited to 'jstests/sharding/shard_keycount.js')
-rw-r--r-- | jstests/sharding/shard_keycount.js | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/jstests/sharding/shard_keycount.js b/jstests/sharding/shard_keycount.js index 9a63a2cfdce..ae4c1d58574 100644 --- a/jstests/sharding/shard_keycount.js +++ b/jstests/sharding/shard_keycount.js @@ -1,46 +1,43 @@ // Tests splitting a chunk twice (function() { + 'use strict'; var s = new ShardingTest({name: "shard_keycount", shards: 2, mongos: 1, other: {chunkSize: 1}}); - dbName = "test"; - collName = "foo"; - ns = dbName + "." + collName; + var dbName = "test"; + var collName = "foo"; + var ns = dbName + "." + collName; - db = s.getDB(dbName); + var db = s.getDB(dbName); for (var i = 0; i < 10; i++) { db.foo.insert({_id: i}); } // Enable sharding on DB - s.adminCommand({enablesharding: dbName}); + assert.commandWorked(s.s0.adminCommand({enablesharding: dbName})); s.ensurePrimaryShard(dbName, 'shard0001'); // Enable sharding on collection - s.adminCommand({shardcollection: ns, key: {_id: 1}}); + assert.commandWorked(s.s0.adminCommand({shardcollection: ns, key: {_id: 1}})); // Split into two chunks - s.adminCommand({split: ns, find: {_id: 3}}); + assert.commandWorked(s.s0.adminCommand({split: ns, find: {_id: 3}})); - coll = db.getCollection(collName); + var coll = db.getCollection(collName); // Split chunk again - s.adminCommand({split: ns, find: {_id: 3}}); + assert.commandWorked(s.s0.adminCommand({split: ns, find: {_id: 3}})); - coll.update({_id: 3}, {_id: 3}); + assert.writeOK(coll.update({_id: 3}, {_id: 3})); // Split chunk again - s.adminCommand({split: ns, find: {_id: 3}}); + assert.commandWorked(s.s0.adminCommand({split: ns, find: {_id: 3}})); - coll.update({_id: 3}, {_id: 3}); + assert.writeOK(coll.update({_id: 3}, {_id: 3})); // Split chunk again - // FAILS since the key count is based on the full index, not the chunk itself - // i.e. Split point calc'd is 5 key offset (10 documents), but only four docs - // in chunk with bounds _id : 0 => 5 - s.adminCommand({split: ns, find: {_id: 3}}); + assert.commandWorked(s.s0.adminCommand({split: ns, find: {_id: 3}})); s.stop(); - -}); +})(); |