summaryrefslogtreecommitdiff
path: root/jstests/sharding/sharding_multiple_ns_rs.js
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-10-10 10:37:49 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-10-10 14:50:19 -0400
commit2463c3abda86bceae80775d05f5925064cf01874 (patch)
tree6d799e812ff6659c08924984750d412bbefbd2d2 /jstests/sharding/sharding_multiple_ns_rs.js
parent63222d35678ad0bc3419e6e4bdd586da5b16acce (diff)
downloadmongo-2463c3abda86bceae80775d05f5925064cf01874.tar.gz
SERVER-31184 Improve checks in sharding tests
Diffstat (limited to 'jstests/sharding/sharding_multiple_ns_rs.js')
-rw-r--r--jstests/sharding/sharding_multiple_ns_rs.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/jstests/sharding/sharding_multiple_ns_rs.js b/jstests/sharding/sharding_multiple_ns_rs.js
index d59eac888cb..80bde2effca 100644
--- a/jstests/sharding/sharding_multiple_ns_rs.js
+++ b/jstests/sharding/sharding_multiple_ns_rs.js
@@ -5,29 +5,30 @@
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
(function() {
+ 'use strict';
+
load("jstests/replsets/rslib.js");
- var s = new ShardingTest(
- {name: "Sharding multiple ns", shards: 1, mongos: 1, other: {rs: true, chunkSize: 1}});
+ var s = new ShardingTest({shards: 1, mongos: 1, other: {rs: true, chunkSize: 1}});
- s.adminCommand({enablesharding: "test"});
- s.adminCommand({shardcollection: "test.foo", key: {_id: 1}});
+ assert.commandWorked(s.s0.adminCommand({enablesharding: "test"}));
+ assert.commandWorked(s.s0.adminCommand({shardcollection: "test.foo", key: {_id: 1}}));
- db = s.getDB("test");
+ var db = s.getDB("test");
var bulk = db.foo.initializeUnorderedBulkOp();
var bulk2 = db.bar.initializeUnorderedBulkOp();
- for (i = 0; i < 100; i++) {
+ for (var i = 0; i < 100; i++) {
bulk.insert({_id: i, x: i});
bulk2.insert({_id: i, x: i});
}
assert.writeOK(bulk.execute());
assert.writeOK(bulk2.execute());
- sh.splitAt("test.foo", {_id: 50});
+ s.splitAt("test.foo", {_id: 50});
- other = new Mongo(s.s.name);
- dbother = other.getDB("test");
+ var other = new Mongo(s.s0.name);
+ var dbother = other.getDB("test");
assert.eq(5, db.foo.findOne({_id: 5}).x);
assert.eq(5, dbother.foo.findOne({_id: 5}).x);
@@ -35,11 +36,11 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
assert.eq(5, db.bar.findOne({_id: 5}).x);
assert.eq(5, dbother.bar.findOne({_id: 5}).x);
- s._rs[0].test.awaitReplication();
- s._rs[0].test.stopMaster(15);
+ s.rs0.awaitReplication();
+ s.rs0.stopMaster(15);
// Wait for the primary to come back online...
- var primary = s._rs[0].test.getPrimary();
+ var primary = s.rs0.getPrimary();
// Wait for the mongos to recognize the new primary...
awaitRSClientHosts(db.getMongo(), primary, {ismaster: true});
@@ -47,10 +48,10 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
assert.eq(5, db.foo.findOne({_id: 5}).x);
assert.eq(5, db.bar.findOne({_id: 5}).x);
- s.adminCommand({shardcollection: "test.bar", key: {_id: 1}});
- sh.splitAt("test.bar", {_id: 50});
+ assert.commandWorked(s.s0.adminCommand({shardcollection: "test.bar", key: {_id: 1}}));
+ s.splitAt("test.bar", {_id: 50});
- yetagain = new Mongo(s.s.name);
+ var yetagain = new Mongo(s.s.name);
assert.eq(5, yetagain.getDB("test").bar.findOne({_id: 5}).x);
assert.eq(5, yetagain.getDB("test").foo.findOne({_id: 5}).x);
@@ -58,5 +59,4 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
assert.eq(5, dbother.foo.findOne({_id: 5}).x);
s.stop();
-
})();