diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2017-06-26 19:42:16 +0100 |
---|---|---|
committer | Bernard Gorman <bernard.gorman@gmail.com> | 2017-06-26 22:38:44 +0100 |
commit | dee571928ef0b7adf39235e95c73e51fb6427d60 (patch) | |
tree | 1132f2a8b0eb2091663349feb6ed36084eba03c7 /jstests/aggregation | |
parent | 6dd8ca2e84e845483a4d4ccf2be028346802d868 (diff) | |
download | mongo-dee571928ef0b7adf39235e95c73e51fb6427d60.tar.gz |
SERVER-28978 Fix presplit behaviour in shard_host_info.js test
Diffstat (limited to 'jstests/aggregation')
-rw-r--r-- | jstests/aggregation/sources/collStats/shard_host_info.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/jstests/aggregation/sources/collStats/shard_host_info.js b/jstests/aggregation/sources/collStats/shard_host_info.js index 48cee745f31..e462bb3e08a 100644 --- a/jstests/aggregation/sources/collStats/shard_host_info.js +++ b/jstests/aggregation/sources/collStats/shard_host_info.js @@ -24,21 +24,20 @@ // Test that both shard and hostname are present for $collStats results on a sharded cluster. const st = new ShardingTest({name: jsTestName(), shards: 2}); + st.stopBalancer(); + testDB = st.s.getDB(jsTestName()); testColl = testDB.test; - st.stopBalancer(); + assert.commandWorked(testDB.dropDatabase()); - // Enable sharding and place one chunk on each shard. + // Enable sharding on the test database. assert.commandWorked(testDB.adminCommand({enableSharding: testDB.getName()})); - assert.commandWorked( - testDB.adminCommand({shardCollection: testColl.getFullName(), key: {_id: 1}})); - - st.ensurePrimaryShard(testDB.getName(), "shard0000"); - assert.commandWorked(testDB.adminCommand({split: testColl.getFullName(), middle: {_id: 0}})); + // Shard 'testColl' on {_id: 'hashed'}. This will automatically presplit the collection and + // place chunks on each shard. assert.commandWorked( - testDB.adminCommand({moveChunk: testColl.getFullName(), find: {_id: 0}, to: "shard0001"})); + testDB.adminCommand({shardCollection: testColl.getFullName(), key: {_id: "hashed"}})); // Group $collStats result by $shard and $host to confirm that both fields are present. assert.eq(testColl |