summaryrefslogtreecommitdiff
path: root/jstests/ssl/ssl_uri.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/ssl/ssl_uri.js
parentc9599d8610c3da0b7c3da65667aff821063cf5b9 (diff)
downloadmongo-c1a45ebbb0530e3d0201321d725527f1eb83ffce.tar.gz
Apply formatting per `clang-format-7.0.1`
Diffstat (limited to 'jstests/ssl/ssl_uri.js')
-rw-r--r--jstests/ssl/ssl_uri.js100
1 files changed, 50 insertions, 50 deletions
diff --git a/jstests/ssl/ssl_uri.js b/jstests/ssl/ssl_uri.js
index 9d43217a46b..830bba98984 100644
--- a/jstests/ssl/ssl_uri.js
+++ b/jstests/ssl/ssl_uri.js
@@ -1,65 +1,65 @@
// Test that the ssl=true/false option is honored in shell URIs.
(function() {
- "use strict";
+"use strict";
- var shouldSucceed = function(uri) {
- var conn = new Mongo(uri);
- var res = conn.getDB('admin').runCommand({"ismaster": 1});
- assert(res.ok);
- };
+var shouldSucceed = function(uri) {
+ var conn = new Mongo(uri);
+ var res = conn.getDB('admin').runCommand({"ismaster": 1});
+ assert(res.ok);
+};
- var shouldFail = function(uri) {
- assert.throws(function(uri) {
- var conn = new Mongo(uri);
- }, [uri], "network error while attempting to run command");
- };
+var shouldFail = function(uri) {
+ assert.throws(function(uri) {
+ var conn = new Mongo(uri);
+ }, [uri], "network error while attempting to run command");
+};
- // Start up a mongod with ssl required.
- var sslMongo = MongoRunner.runMongod({
- sslMode: "requireSSL",
- sslPEMKeyFile: "jstests/libs/server.pem",
- sslCAFile: "jstests/libs/ca.pem",
- });
+// Start up a mongod with ssl required.
+var sslMongo = MongoRunner.runMongod({
+ sslMode: "requireSSL",
+ sslPEMKeyFile: "jstests/libs/server.pem",
+ sslCAFile: "jstests/libs/ca.pem",
+});
- var sslURI = "mongodb://localhost:" + sslMongo.port + "/admin";
+var sslURI = "mongodb://localhost:" + sslMongo.port + "/admin";
- // When talking to a server with SSL, connecting with ssl=false fails.
- shouldSucceed(sslURI);
- shouldSucceed(sslURI + "?ssl=true");
- shouldFail(sslURI + "?ssl=false");
+// When talking to a server with SSL, connecting with ssl=false fails.
+shouldSucceed(sslURI);
+shouldSucceed(sslURI + "?ssl=true");
+shouldFail(sslURI + "?ssl=false");
- var connectWithURI = function(uri) {
- return runMongoProgram('./mongo',
- '--ssl',
- '--sslAllowInvalidCertificates',
- '--sslCAFile',
- 'jstests/libs/ca.pem',
- '--sslPEMKeyFile',
- 'jstests/libs/client.pem',
- uri,
- '--eval',
- 'db.runCommand({ismaster: 1})');
- };
+var connectWithURI = function(uri) {
+ return runMongoProgram('./mongo',
+ '--ssl',
+ '--sslAllowInvalidCertificates',
+ '--sslCAFile',
+ 'jstests/libs/ca.pem',
+ '--sslPEMKeyFile',
+ 'jstests/libs/client.pem',
+ uri,
+ '--eval',
+ 'db.runCommand({ismaster: 1})');
+};
- var shouldConnect = function(uri) {
- assert.eq(connectWithURI(uri), 0, "should have been able to connect with " + uri);
- };
+var shouldConnect = function(uri) {
+ assert.eq(connectWithURI(uri), 0, "should have been able to connect with " + uri);
+};
- var shouldNotConnect = function(uri) {
- assert.eq(connectWithURI(uri), 1, "should not have been able to connect with " + uri);
- };
+var shouldNotConnect = function(uri) {
+ assert.eq(connectWithURI(uri), 1, "should not have been able to connect with " + uri);
+};
- // When talking to a server with SSL, connecting with ssl=false on the command line fails.
- shouldConnect(sslURI);
- shouldNotConnect(sslURI + "?ssl=false");
- shouldConnect(sslURI + "?ssl=true");
+// When talking to a server with SSL, connecting with ssl=false on the command line fails.
+shouldConnect(sslURI);
+shouldNotConnect(sslURI + "?ssl=false");
+shouldConnect(sslURI + "?ssl=true");
- // Connecting with ssl=true without --ssl will not work
- var res =
- runMongoProgram('./mongo', sslURI + "?ssl=true", '--eval', 'db.runCommand({ismaster: 1})');
- assert.eq(res, 1, "should not have been able to connect without --ssl");
+// Connecting with ssl=true without --ssl will not work
+var res =
+ runMongoProgram('./mongo', sslURI + "?ssl=true", '--eval', 'db.runCommand({ismaster: 1})');
+assert.eq(res, 1, "should not have been able to connect without --ssl");
- // Clean up
- MongoRunner.stopMongod(sslMongo);
+// Clean up
+MongoRunner.stopMongod(sslMongo);
}());