summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2017-10-06 15:12:40 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-10-11 00:52:09 -0400
commit45d35fe3fcefefe1282b8e0dfc8cd76cb247951d (patch)
tree6643f175807ae1c20902885846d29e888127f9a6 /jstests/noPassthroughWithMongod
parent8b3694d704d4c472adba87e8fb0827372324c215 (diff)
downloadmongo-45d35fe3fcefefe1282b8e0dfc8cd76cb247951d.tar.gz
SERVER-31184 Make servers automatically set up config.system.sessions
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/replica_set_shard_version.js91
1 files changed, 47 insertions, 44 deletions
diff --git a/jstests/noPassthroughWithMongod/replica_set_shard_version.js b/jstests/noPassthroughWithMongod/replica_set_shard_version.js
index b8fe681cc06..73c520c14ac 100644
--- a/jstests/noPassthroughWithMongod/replica_set_shard_version.js
+++ b/jstests/noPassthroughWithMongod/replica_set_shard_version.js
@@ -1,61 +1,64 @@
-// Tests whether a Replica Set in a mongos cluster can cause versioning problems
+/**
+ * Tests whether a Replica Set in a mongos cluster can cause versioning problems.
+ */
-jsTestLog("Starting sharded cluster...");
+// Checking UUID consistency involves talking to a shard node, which in this test has been
+// stepped-down
+TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
-var st = new ShardingTest({shards: 1, mongos: 2, other: {rs: true}});
+(function() {
+ 'use strict';
-// Uncomment to stop the balancer, since the balancer usually initializes the shard automatically
-// SERVER-4921 is otherwise hard to manifest
-// st.stopBalancer()
+ var st = new ShardingTest({shards: 1, mongos: 2, other: {rs: true, enableBalancer: true}});
-var mongosA = st.s0;
-var mongosB = st.s1;
-var shard = st.shard0;
+ var mongosA = st.s0;
+ var mongosB = st.s1;
+ var shard = st.shard0;
-coll = mongosA.getCollection(jsTestName() + ".coll");
+ var coll = mongosA.getCollection(jsTestName() + ".coll");
-// Wait for primary and then initialize shard SERVER-5130
-st.rs0.getPrimary();
-coll.findOne();
-
-var sadmin = shard.getDB("admin");
-assert.throws(function() {
- sadmin.runCommand({replSetStepDown: 3000, force: true});
-});
+ // Wait for primary and then initialize shard SERVER-5130
+ st.rs0.getPrimary();
+ coll.findOne();
-st.rs0.getPrimary();
+ var sadmin = shard.getDB("admin");
+ assert.throws(function() {
+ sadmin.runCommand({replSetStepDown: 3000, force: true});
+ });
-mongosA.getDB("admin").runCommand({setParameter: 1, traceExceptions: true});
+ st.rs0.getPrimary();
-try {
- // This _almost_ always fails, unless the new primary is already detected. If if fails, it
- // should
- // mark the master as bad, so mongos will reload the replica set master next request
- // TODO: Can we just retry and succeed here?
- coll.findOne();
-} catch (e) {
- print("This error is expected : ");
- printjson(e);
-}
+ mongosA.getDB("admin").runCommand({setParameter: 1, traceExceptions: true});
-jsTest.log("Running query which should succeed...");
+ try {
+ // This _almost_ always fails, unless the new primary is already detected. If if fails, it
+ // should mark the master as bad, so mongos will reload the replica set master next request.
+ //
+ // TODO: Can we just retry and succeed here?
+ coll.findOne();
+ } catch (e) {
+ print("This error is expected : ");
+ printjson(e);
+ }
-// This should always succeed without throwing an error
-coll.findOne();
+ jsTest.log("Running query which should succeed...");
-mongosA.getDB("admin").runCommand({setParameter: 1, traceExceptions: false});
+ // This should always succeed without throwing an error
+ coll.findOne();
-// now check secondary
+ mongosA.getDB("admin").runCommand({setParameter: 1, traceExceptions: false});
-assert.throws(function() {
- sadmin.runCommand({replSetStepDown: 3000, force: true});
-});
+ // Now check secondary
+ assert.throws(function() {
+ sadmin.runCommand({replSetStepDown: 3000, force: true});
+ });
-// Can't use the mongosB - SERVER-5128
-other = new Mongo(mongosA.host);
-other.setSlaveOk(true);
-other = other.getCollection(jsTestName() + ".coll");
+ // Can't use the mongosB - SERVER-5128
+ var other = new Mongo(mongosA.host);
+ other.setSlaveOk(true);
+ other = other.getCollection(jsTestName() + ".coll");
-print("eliot: " + tojson(other.findOne()));
+ print("eliot: " + tojson(other.findOne()));
-st.stop();
+ st.stop();
+})();