diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/noPassthrough/unsupported_change_stream_deployments.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/noPassthrough/unsupported_change_stream_deployments.js')
-rw-r--r-- | jstests/noPassthrough/unsupported_change_stream_deployments.js | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/jstests/noPassthrough/unsupported_change_stream_deployments.js b/jstests/noPassthrough/unsupported_change_stream_deployments.js index 3f24a8b0f2c..c342341da69 100644 --- a/jstests/noPassthrough/unsupported_change_stream_deployments.js +++ b/jstests/noPassthrough/unsupported_change_stream_deployments.js @@ -2,60 +2,59 @@ // @tags: [requires_sharding, uses_change_streams] (function() { - "use strict"; - load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. - // For supportsMajorityReadConcern(). - load("jstests/multiVersion/libs/causal_consistency_helpers.js"); - load("jstests/libs/feature_compatibility_version.js"); // For checkFCV. +"use strict"; +load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. +// For supportsMajorityReadConcern(). +load("jstests/multiVersion/libs/causal_consistency_helpers.js"); +load("jstests/libs/feature_compatibility_version.js"); // For checkFCV. - // Skip this test if running with --nojournal and WiredTiger. - if (jsTest.options().noJournal && - (!jsTest.options().storageEngine || jsTest.options().storageEngine === "wiredTiger")) { - print("Skipping test because running WiredTiger without journaling isn't a valid" + - " replica set configuration"); - return; - } +// Skip this test if running with --nojournal and WiredTiger. +if (jsTest.options().noJournal && + (!jsTest.options().storageEngine || jsTest.options().storageEngine === "wiredTiger")) { + print("Skipping test because running WiredTiger without journaling isn't a valid" + + " replica set configuration"); + return; +} - if (!supportsMajorityReadConcern()) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - return; - } +if (!supportsMajorityReadConcern()) { + jsTestLog("Skipping test since storage engine doesn't support majority read concern."); + return; +} - function assertChangeStreamNotSupportedOnConnection(conn) { - const notReplicaSetErrorCode = 40573; - assertErrorCode( - conn.getDB("test").non_existent, [{$changeStream: {}}], notReplicaSetErrorCode); - assertErrorCode(conn.getDB("test").non_existent, - [{$changeStream: {fullDocument: "updateLookup"}}], - notReplicaSetErrorCode); - } +function assertChangeStreamNotSupportedOnConnection(conn) { + const notReplicaSetErrorCode = 40573; + assertErrorCode(conn.getDB("test").non_existent, [{$changeStream: {}}], notReplicaSetErrorCode); + assertErrorCode(conn.getDB("test").non_existent, + [{$changeStream: {fullDocument: "updateLookup"}}], + notReplicaSetErrorCode); +} - const conn = MongoRunner.runMongod({enableMajorityReadConcern: ""}); - assert.neq(null, conn, "mongod was unable to start up"); - // $changeStream cannot run on a non-existent database. - assert.writeOK(conn.getDB("test").ensure_db_exists.insert({})); - assertChangeStreamNotSupportedOnConnection(conn); - assert.eq(0, MongoRunner.stopMongod(conn)); +const conn = MongoRunner.runMongod({enableMajorityReadConcern: ""}); +assert.neq(null, conn, "mongod was unable to start up"); +// $changeStream cannot run on a non-existent database. +assert.writeOK(conn.getDB("test").ensure_db_exists.insert({})); +assertChangeStreamNotSupportedOnConnection(conn); +assert.eq(0, MongoRunner.stopMongod(conn)); - // Test a sharded cluster with standalone shards. - // TODO: Remove 'shardAsReplicaSet: false' when SERVER-32672 is fixed. - const clusterWithStandalones = new ShardingTest({ - shards: 2, - other: {shardOptions: {enableMajorityReadConcern: ""}}, - config: 1, - shardAsReplicaSet: false - }); - // Make sure the database exists before running any commands. - const mongosDB = clusterWithStandalones.getDB("test"); - // enableSharding will create the db at the cluster level but not on the shards. $changeStream - // through mongoS will be allowed to run on the shards despite the lack of a database. - assert.commandWorked(mongosDB.adminCommand({enableSharding: "test"})); - assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.s); - // Shard the 'ensure_db_exists' collection on a hashed key before running $changeStream on the - // shards directly. This will ensure that the database is created on both shards. - assert.commandWorked( - mongosDB.adminCommand({shardCollection: "test.ensure_db_exists", key: {_id: "hashed"}})); - assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.shard0); - assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.shard1); - clusterWithStandalones.stop(); +// Test a sharded cluster with standalone shards. +// TODO: Remove 'shardAsReplicaSet: false' when SERVER-32672 is fixed. +const clusterWithStandalones = new ShardingTest({ + shards: 2, + other: {shardOptions: {enableMajorityReadConcern: ""}}, + config: 1, + shardAsReplicaSet: false +}); +// Make sure the database exists before running any commands. +const mongosDB = clusterWithStandalones.getDB("test"); +// enableSharding will create the db at the cluster level but not on the shards. $changeStream +// through mongoS will be allowed to run on the shards despite the lack of a database. +assert.commandWorked(mongosDB.adminCommand({enableSharding: "test"})); +assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.s); +// Shard the 'ensure_db_exists' collection on a hashed key before running $changeStream on the +// shards directly. This will ensure that the database is created on both shards. +assert.commandWorked( + mongosDB.adminCommand({shardCollection: "test.ensure_db_exists", key: {_id: "hashed"}})); +assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.shard0); +assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.shard1); +clusterWithStandalones.stop(); }()); |