summaryrefslogtreecommitdiff
path: root/jstests/sharding/agg_error_reports_shard_host_and_port.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
commitc1a45ebbb0530e3d0201321d725527f1eb83ffce (patch)
treef523079dc5ded3052eefbdcaae424b7502df5b25 /jstests/sharding/agg_error_reports_shard_host_and_port.js
parentc9599d8610c3da0b7c3da65667aff821063cf5b9 (diff)
downloadmongo-c1a45ebbb0530e3d0201321d725527f1eb83ffce.tar.gz
Apply formatting per `clang-format-7.0.1`
Diffstat (limited to 'jstests/sharding/agg_error_reports_shard_host_and_port.js')
-rw-r--r--jstests/sharding/agg_error_reports_shard_host_and_port.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/jstests/sharding/agg_error_reports_shard_host_and_port.js b/jstests/sharding/agg_error_reports_shard_host_and_port.js
index 3a73c1d2493..346351d35e3 100644
--- a/jstests/sharding/agg_error_reports_shard_host_and_port.js
+++ b/jstests/sharding/agg_error_reports_shard_host_and_port.js
@@ -1,34 +1,34 @@
// Tests that an aggregation error which occurs on a sharded collection will send an error message
// containing the host and port of the shard where the error occurred.
(function() {
- "use strict";
+"use strict";
- load("jstests/aggregation/extras/utils.js"); // For assertErrMsgContains.
+load("jstests/aggregation/extras/utils.js"); // For assertErrMsgContains.
- const st = new ShardingTest({shards: 2, config: 1});
+const st = new ShardingTest({shards: 2, config: 1});
- const mongosDb = st.s.getDB(jsTestName());
- const coll = mongosDb.getCollection("foo");
+const mongosDb = st.s.getDB(jsTestName());
+const coll = mongosDb.getCollection("foo");
- // Enable sharding on the test DB and ensure its primary is shard 0.
- assert.commandWorked(mongosDb.adminCommand({enableSharding: mongosDb.getName()}));
- st.ensurePrimaryShard(mongosDb.getName(), st.rs0.getURL());
+// Enable sharding on the test DB and ensure its primary is shard 0.
+assert.commandWorked(mongosDb.adminCommand({enableSharding: mongosDb.getName()}));
+st.ensurePrimaryShard(mongosDb.getName(), st.rs0.getURL());
- // Shard the collection.
- coll.drop();
- st.shardColl(coll, {_id: 1}, {_id: 0}, {_id: 1});
+// Shard the collection.
+coll.drop();
+st.shardColl(coll, {_id: 1}, {_id: 0}, {_id: 1});
- assert.commandWorked(coll.insert({_id: 0}));
+assert.commandWorked(coll.insert({_id: 0}));
- // Run an aggregation which will fail on shard 1, and verify that the error message contains
- // the host and port of the shard that failed.
- // We need to be careful here to involve some data in the computation that is actually
- // sent to the shard before failing (i.e. "$_id") so that mongos doesn't short-curcuit and
- // fail during optimization.
- const pipe = [{$project: {a: {$divide: ["$_id", 0]}}}];
- const divideByZeroErrorCode = 16608;
+// Run an aggregation which will fail on shard 1, and verify that the error message contains
+// the host and port of the shard that failed.
+// We need to be careful here to involve some data in the computation that is actually
+// sent to the shard before failing (i.e. "$_id") so that mongos doesn't short-curcuit and
+// fail during optimization.
+const pipe = [{$project: {a: {$divide: ["$_id", 0]}}}];
+const divideByZeroErrorCode = 16608;
- assertErrMsgContains(coll, pipe, divideByZeroErrorCode, st.rs1.getPrimary().host);
+assertErrMsgContains(coll, pipe, divideByZeroErrorCode, st.rs1.getPrimary().host);
- st.stop();
+st.stop();
}());