summaryrefslogtreecommitdiff
path: root/jstests/sharding/shard_config_db_collections.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/shard_config_db_collections.js')
-rw-r--r--jstests/sharding/shard_config_db_collections.js72
1 files changed, 35 insertions, 37 deletions
diff --git a/jstests/sharding/shard_config_db_collections.js b/jstests/sharding/shard_config_db_collections.js
index 73e711946c1..8f8f324957b 100644
--- a/jstests/sharding/shard_config_db_collections.js
+++ b/jstests/sharding/shard_config_db_collections.js
@@ -1,52 +1,50 @@
(function() {
- 'use strict';
+'use strict';
- // Database-level tests
- {
- var st = new ShardingTest({shards: 2});
- var config = st.s.getDB('config');
- var admin = st.s.getDB('admin');
+// Database-level tests
+{
+ var st = new ShardingTest({shards: 2});
+ var config = st.s.getDB('config');
+ var admin = st.s.getDB('admin');
- // At first, there should not be an entry for config
- assert.eq(0, config.databases.count({"_id": "config"}));
+ // At first, there should not be an entry for config
+ assert.eq(0, config.databases.count({"_id": "config"}));
- // Test that we can enable sharding on the config db
- assert.commandWorked(admin.runCommand({enableSharding: 'config'}));
+ // Test that we can enable sharding on the config db
+ assert.commandWorked(admin.runCommand({enableSharding: 'config'}));
- // We should never have a metadata doc for config, it is generated in-mem
- assert.eq(0, config.databases.count({"_id": "config"}));
+ // We should never have a metadata doc for config, it is generated in-mem
+ assert.eq(0, config.databases.count({"_id": "config"}));
- // Test that you cannot set the primary shard for config (not even to 'config')
- assert.commandFailed(admin.runCommand({movePrimary: 'config', to: st.shard0.shardName}));
- assert.commandFailed(admin.runCommand({movePrimary: 'config', to: 'config'}));
+ // Test that you cannot set the primary shard for config (not even to 'config')
+ assert.commandFailed(admin.runCommand({movePrimary: 'config', to: st.shard0.shardName}));
+ assert.commandFailed(admin.runCommand({movePrimary: 'config', to: 'config'}));
- st.stop();
- }
+ st.stop();
+}
- // Test that only system.sessions may be sharded.
- {
- var st = new ShardingTest({shards: 2});
- var admin = st.s.getDB('admin');
+// Test that only system.sessions may be sharded.
+{
+ var st = new ShardingTest({shards: 2});
+ var admin = st.s.getDB('admin');
- assert.commandWorked(
- admin.runCommand({shardCollection: "config.system.sessions", key: {_id: 1}}));
- assert.eq(0, st.s.getDB('config').chunks.count({"shard": "config"}));
+ assert.commandWorked(
+ admin.runCommand({shardCollection: "config.system.sessions", key: {_id: 1}}));
+ assert.eq(0, st.s.getDB('config').chunks.count({"shard": "config"}));
- assert.commandFailed(
- admin.runCommand({shardCollection: "config.anythingelse", key: {_id: 1}}));
+ assert.commandFailed(admin.runCommand({shardCollection: "config.anythingelse", key: {_id: 1}}));
- st.stop();
- }
+ st.stop();
+}
- // Cannot shard things in config without shards.
- {
- var st = new ShardingTest({shards: 0});
- var admin = st.s.getDB('admin');
+// Cannot shard things in config without shards.
+{
+ var st = new ShardingTest({shards: 0});
+ var admin = st.s.getDB('admin');
- assert.commandFailed(
- admin.runCommand({shardCollection: "config.system.sessions", key: {_id: 1}}));
-
- st.stop();
- }
+ assert.commandFailed(
+ admin.runCommand({shardCollection: "config.system.sessions", key: {_id: 1}}));
+ st.stop();
+}
})();