@@ -31,20 +31,20 @@ const tests = [
3131 description : 'with socketTimeoutMS' ,
3232 connectionString :
3333 'mongodb://localhost:27017/sampleDb' +
34- '?socketTimeoutMS=30000&w=majority&readPreference=primary&ssl=false'
34+ '?socketTimeoutMS=30000&w=majority&readPreference=primary&directConnection=true& ssl=false'
3535 // only: true // Uncomment this line to run only one test debugging purpose
3636 } ,
3737 {
3838 description : 'with compression' ,
3939 connectionString :
4040 'mongodb://localhost:27017/?compressors=snappy%2Czlib&' +
41- 'readPreference=primary&ssl=false'
41+ 'readPreference=primary&directConnection=true& ssl=false'
4242 } ,
4343 {
4444 description : 'with zlibCompressionLevel' ,
4545 connectionString :
4646 'mongodb://localhost:27017/?zlibCompressionLevel=9&' +
47- 'readPreference=primary&ssl=false'
47+ 'readPreference=primary&directConnection=true& ssl=false'
4848 } ,
4949 {
5050 description :
@@ -59,7 +59,7 @@ const tests = [
5959 connectionString :
6060 'mongodb://localhost:27017/test?' +
6161 'maxPoolSize=50&minPoolSize=5&maxIdleTimeMS=1000&waitQueueMultiple=200&waitQueueTimeoutMS=100&' +
62- 'w=1&wTimeoutMS=2000&journal=true&readPreference=primary&ssl=false'
62+ 'w=1&wTimeoutMS=2000&journal=true&readPreference=primary&directConnection=true& ssl=false'
6363 } ,
6464 {
6565 description : 'with readConcernLevel' ,
@@ -84,13 +84,13 @@ const tests = [
8484 description : 'with authSource and authMechanism (SCRAM-SHA-1)' ,
8585 connectionString :
8686 'mongodb://%40rlo:w%40of@localhost:27017/dogdb?authSource=catdb&' +
87- 'readPreference=primary&authMechanism=SCRAM-SHA-1&ssl=false'
87+ 'readPreference=primary&authMechanism=SCRAM-SHA-1&directConnection=true& ssl=false'
8888 } ,
8989 {
9090 description : 'with authSource and authMechanism (SCRAM-SHA-256)' ,
9191 connectionString :
9292 'mongodb://%40rlo:w%40of@localhost:27017/dogdb?authSource=catdb&' +
93- 'authMechanism=SCRAM-SHA-256&readPreference=primary&ssl=false'
93+ 'authMechanism=SCRAM-SHA-256&readPreference=primary&directConnection=true& ssl=false'
9494 } ,
9595 {
9696 description : 'with password which is ignored for GSSAPI' ,
@@ -101,15 +101,15 @@ const tests = [
101101 expectedConnectionString :
102102 'mongodb://%40rlo@localhost:27017/?' +
103103 'authMechanism=GSSAPI&readPreference=primary&' +
104- 'authSource=%24external&ssl=false&authSource=$external'
104+ 'authSource=%24external&directConnection=true& ssl=false&authSource=$external'
105105 } ,
106106 {
107107 description : 'with authMechanismProperties and gssapiServiceName' ,
108108 connectionString :
109109 'mongodb://%40rlo@localhost:27017/?' +
110110 'authMechanism=GSSAPI&readPreference=primary&' +
111111 'authSource=%24external&authMechanismProperties=CANONICALIZE_HOST_NAME%3Atrue&' +
112- 'gssapiCanonicalizeHostName=true&ssl=false&authSource=$external'
112+ 'gssapiCanonicalizeHostName=true&directConnection=true& ssl=false&authSource=$external'
113113 } ,
114114 {
115115 description :
@@ -123,22 +123,22 @@ const tests = [
123123 description : 'with serverSelectionTryOnce' ,
124124 connectionString :
125125 'mongodb://a:27017/?readPreference=primary&' +
126- 'serverSelectionTryOnce=false&ssl=false'
126+ 'serverSelectionTryOnce=false&directConnection=true& ssl=false'
127127 } ,
128128 {
129129 description : 'with appName' ,
130130 connectionString :
131- 'mongodb://localhost:27017/?readPreference=primary&appname=foo&ssl=false'
131+ 'mongodb://localhost:27017/?readPreference=primary&appname=foo&directConnection=true& ssl=false'
132132 } ,
133133 {
134134 description : 'with retryWrites' ,
135135 connectionString :
136- 'mongodb://hostname:27017/?readPreference=primary&retryWrites=true&ssl=false'
136+ 'mongodb://hostname:27017/?readPreference=primary&retryWrites=true&directConnection=true& ssl=false'
137137 } ,
138138 {
139139 description : 'with uuidRepresentation' ,
140140 connectionString :
141- 'mongodb://foo:27017/?readPreference=primary&uuidRepresentation=csharpLegacy&ssl=false'
141+ 'mongodb://foo:27017/?readPreference=primary&uuidRepresentation=csharpLegacy&directConnection=true& ssl=false'
142142 }
143143] ;
144144
@@ -151,8 +151,12 @@ describe('connection model', () => {
151151
152152 const c = new Connection ( result . toJSON ( ) ) ;
153153
154- expect ( c . driverUrl ) . to . be . equal ( test . expectedConnectionString || test . connectionString ) ;
155- done ( ) ;
154+ try {
155+ expect ( c . driverUrl ) . to . be . equal ( test . expectedConnectionString || test . connectionString ) ;
156+ done ( ) ;
157+ } catch ( e ) {
158+ done ( e ) ;
159+ }
156160 } ) ;
157161 const runMode = test . only ? it . only : it ;
158162 runMode ( test . description , runTest ) ;
0 commit comments