Skip to content

Commit 9d1bb79

Browse files
committed
Added SNI test and updated runner and gitignore
1 parent 7aa7160 commit 9d1bb79

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jsconfig.json
2929
manual_tests/
3030
docs/build
3131
docs/Makefile
32+
*.lock
3233

3334
# Directory for dbs
3435
db

test/functional/sni_tests.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"use strict";
2+
3+
/**
4+
* @ignore
5+
*/
6+
exports['Should correct connect to snitest1.10gen.cc'] = {
7+
metadata: { requires: { topology: 'sni', os: "!win32" } },
8+
9+
// The actual test we wish to run
10+
test: function(configuration, test) {
11+
var MongoClient = configuration.require.MongoClient
12+
13+
console.log("====================================================== 0")
14+
// Let's write the actual connection code
15+
// MongoClient.connect("mongodb://snitest1.10gen.cc:27777/tests?ssl=true&maxPoolSize=1", {
16+
MongoClient.connect("mongodb://snitest2.mongodb.com:27777/?ssl=true", {
17+
// MongoClient.connect("mongodb://snitest2.cloudmanager.mongodb.com:27777/tests?ssl=true&maxPoolSize=1", {
18+
servername: 'cloudmanager.mongodb.com',
19+
}, function(err, db) {
20+
console.log("====================================================== 1")
21+
console.dir(err)
22+
test.equal(null, err);
23+
// test.ok(db != null);
24+
25+
// db.collection('test').find().toArray(function(err, docs) {
26+
// test.equal(null, err);
27+
28+
// test.ok(true, docs[0].kerberos);
29+
db.close();
30+
test.done();
31+
// });
32+
});
33+
}
34+
}

test/runner.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ var testFiles = [
318318
, '/test/functional/ssl_mongoclient_tests.js'
319319
, '/test/functional/ssl_validation_tests.js'
320320
, '/test/functional/ssl_x509_connect_tests.js'
321+
, '/test/functional/sni_tests.js'
321322

322323
// SCRAM tests
323324
, '/test/functional/scram_tests.js'
@@ -653,7 +654,7 @@ if(argv.t == 'functional') {
653654

654655
//
655656
// Single server
656-
if(!argv.e || argv.e == 'kerberos' || argv.e == 'ldap') {
657+
if(!argv.e || (argv.e == 'kerberos' || argv.e == 'ldap' || argv.e == 'sni')) {
657658
config = {
658659
host: 'localhost'
659660
, port: 27017

0 commit comments

Comments
 (0)