summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/moveprimary-replset.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod/moveprimary-replset.js')
-rw-r--r--jstests/noPassthroughWithMongod/moveprimary-replset.js104
1 files changed, 52 insertions, 52 deletions
diff --git a/jstests/noPassthroughWithMongod/moveprimary-replset.js b/jstests/noPassthroughWithMongod/moveprimary-replset.js
index 016b2e215c0..9b1e9f7d3bc 100644
--- a/jstests/noPassthroughWithMongod/moveprimary-replset.js
+++ b/jstests/noPassthroughWithMongod/moveprimary-replset.js
@@ -4,56 +4,56 @@
// @tags: [requires_replication, requires_sharding]
(function() {
- "use strict";
-
- var numDocs = 10000;
- var baseName = "moveprimary-replset";
- var testDBName = baseName;
- var testCollName = 'coll';
-
- var shardingTestConfig = {
- name: baseName,
- mongos: 1,
- shards: 2,
- config: 3,
- rs: {nodes: 3},
- other: {manualAddShard: true}
- };
-
- var shardingTest = new ShardingTest(shardingTestConfig);
-
- var replSet1 = shardingTest.rs0;
- var replSet2 = shardingTest.rs1;
-
- var repset1DB = replSet1.getPrimary().getDB(testDBName);
- for (var i = 1; i <= numDocs; i++) {
- repset1DB[testCollName].insert({x: i});
- }
- replSet1.awaitReplication();
-
- var mongosConn = shardingTest.s;
- var testDB = mongosConn.getDB(testDBName);
-
- mongosConn.adminCommand({addshard: replSet1.getURL()});
-
- testDB[testCollName].update({}, {$set: {y: 'hello'}}, false /*upsert*/, true /*multi*/);
- assert.eq(testDB[testCollName].count({y: 'hello'}),
- numDocs,
- 'updating and counting docs via mongos failed');
-
- mongosConn.adminCommand({addshard: replSet2.getURL()});
-
- assert.commandWorked(
- mongosConn.getDB('admin').runCommand({moveprimary: testDBName, to: replSet2.getURL()}));
- mongosConn.getDB('admin').printShardingStatus();
- assert.eq(testDB.getSiblingDB("config").databases.findOne({"_id": testDBName}).primary,
- replSet2.name,
- "Failed to change primary shard for unsharded database.");
-
- testDB[testCollName].update({}, {$set: {z: 'world'}}, false /*upsert*/, true /*multi*/);
- assert.eq(testDB[testCollName].count({z: 'world'}),
- numDocs,
- 'updating and counting docs via mongos failed');
-
- shardingTest.stop();
+"use strict";
+
+var numDocs = 10000;
+var baseName = "moveprimary-replset";
+var testDBName = baseName;
+var testCollName = 'coll';
+
+var shardingTestConfig = {
+ name: baseName,
+ mongos: 1,
+ shards: 2,
+ config: 3,
+ rs: {nodes: 3},
+ other: {manualAddShard: true}
+};
+
+var shardingTest = new ShardingTest(shardingTestConfig);
+
+var replSet1 = shardingTest.rs0;
+var replSet2 = shardingTest.rs1;
+
+var repset1DB = replSet1.getPrimary().getDB(testDBName);
+for (var i = 1; i <= numDocs; i++) {
+ repset1DB[testCollName].insert({x: i});
+}
+replSet1.awaitReplication();
+
+var mongosConn = shardingTest.s;
+var testDB = mongosConn.getDB(testDBName);
+
+mongosConn.adminCommand({addshard: replSet1.getURL()});
+
+testDB[testCollName].update({}, {$set: {y: 'hello'}}, false /*upsert*/, true /*multi*/);
+assert.eq(testDB[testCollName].count({y: 'hello'}),
+ numDocs,
+ 'updating and counting docs via mongos failed');
+
+mongosConn.adminCommand({addshard: replSet2.getURL()});
+
+assert.commandWorked(
+ mongosConn.getDB('admin').runCommand({moveprimary: testDBName, to: replSet2.getURL()}));
+mongosConn.getDB('admin').printShardingStatus();
+assert.eq(testDB.getSiblingDB("config").databases.findOne({"_id": testDBName}).primary,
+ replSet2.name,
+ "Failed to change primary shard for unsharded database.");
+
+testDB[testCollName].update({}, {$set: {z: 'world'}}, false /*upsert*/, true /*multi*/);
+assert.eq(testDB[testCollName].count({z: 'world'}),
+ numDocs,
+ 'updating and counting docs via mongos failed');
+
+shardingTest.stop();
})();