summaryrefslogtreecommitdiff
path: root/jstests/sharding/authConnectionHook.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/authConnectionHook.js')
-rw-r--r--jstests/sharding/authConnectionHook.js72
1 files changed, 33 insertions, 39 deletions
diff --git a/jstests/sharding/authConnectionHook.js b/jstests/sharding/authConnectionHook.js
index 6655d4d5248..73e81393d44 100644
--- a/jstests/sharding/authConnectionHook.js
+++ b/jstests/sharding/authConnectionHook.js
@@ -14,55 +14,49 @@
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
(function() {
- 'use strict';
+'use strict';
- // TODO: Remove 'shardAsReplicaSet: false' when SERVER-32672 is fixed.
- var st = new ShardingTest({
- shards: 2,
- other: {
- keyFile: 'jstests/libs/key1',
- useHostname: true,
- chunkSize: 1,
- shardAsReplicaSet: false
- }
- });
+// TODO: Remove 'shardAsReplicaSet: false' when SERVER-32672 is fixed.
+var st = new ShardingTest({
+ shards: 2,
+ other: {keyFile: 'jstests/libs/key1', useHostname: true, chunkSize: 1, shardAsReplicaSet: false}
+});
- var mongos = st.s;
- var adminDB = mongos.getDB('admin');
- var db = mongos.getDB('test');
+var mongos = st.s;
+var adminDB = mongos.getDB('admin');
+var db = mongos.getDB('test');
- adminDB.createUser({user: 'admin', pwd: 'password', roles: jsTest.adminUserRoles});
+adminDB.createUser({user: 'admin', pwd: 'password', roles: jsTest.adminUserRoles});
- adminDB.auth('admin', 'password');
+adminDB.auth('admin', 'password');
- adminDB.runCommand({enableSharding: "test"});
- st.ensurePrimaryShard('test', 'shard0001');
- adminDB.runCommand({shardCollection: "test.foo", key: {x: 1}});
+adminDB.runCommand({enableSharding: "test"});
+st.ensurePrimaryShard('test', 'shard0001');
+adminDB.runCommand({shardCollection: "test.foo", key: {x: 1}});
- for (var i = 0; i < 100; i++) {
- db.foo.insert({x: i});
- }
+for (var i = 0; i < 100; i++) {
+ db.foo.insert({x: i});
+}
- adminDB.runCommand({split: "test.foo", middle: {x: 50}});
- var curShard = st.getShard("test.foo", {x: 75});
- var otherShard = st.getOther(curShard).name;
- adminDB.runCommand(
- {moveChunk: "test.foo", find: {x: 25}, to: otherShard, _waitForDelete: true});
+adminDB.runCommand({split: "test.foo", middle: {x: 50}});
+var curShard = st.getShard("test.foo", {x: 75});
+var otherShard = st.getOther(curShard).name;
+adminDB.runCommand({moveChunk: "test.foo", find: {x: 25}, to: otherShard, _waitForDelete: true});
- st.printShardingStatus();
+st.printShardingStatus();
- MongoRunner.stopMongod(st.shard0);
- st.shard0 = MongoRunner.runMongod({restart: st.shard0});
+MongoRunner.stopMongod(st.shard0);
+st.shard0 = MongoRunner.runMongod({restart: st.shard0});
- // May fail the first couple times due to socket exceptions
- assert.soon(function() {
- var res = adminDB.runCommand({moveChunk: "test.foo", find: {x: 75}, to: otherShard});
- printjson(res);
- return res.ok;
- });
+// May fail the first couple times due to socket exceptions
+assert.soon(function() {
+ var res = adminDB.runCommand({moveChunk: "test.foo", find: {x: 75}, to: otherShard});
+ printjson(res);
+ return res.ok;
+});
- printjson(db.foo.findOne({x: 25}));
- printjson(db.foo.findOne({x: 75}));
+printjson(db.foo.findOne({x: 25}));
+printjson(db.foo.findOne({x: 75}));
- st.stop();
+st.stop();
})();