File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
test/integration/node-specific Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -339,6 +339,29 @@ describe('class MongoClient', function () {
339339 } ) ;
340340 } ) ;
341341
342+ it ( 'throws ENOTFOUND error when connecting to non-existent host with no auth and loadBalanced=true' , async function ( ) {
343+ const configuration = this . configuration ;
344+ const client = configuration . newClient (
345+ 'mongodb://iLoveJavaScript:27017/test?loadBalanced=true' ,
346+ { serverSelectionTimeoutMS : 100 }
347+ ) ;
348+
349+ const error = await client . connect ( ) . catch ( error => error ) ;
350+ expect ( error ) . to . be . instanceOf ( MongoNetworkError ) ; // not server selection like other topologies
351+ expect ( error . message ) . to . match ( / E N O T F O U N D / ) ;
352+ } ) ;
353+
354+ it ( 'throws an error when srv is not a real record' , async function ( ) {
355+ const client = this . configuration . newClient ( 'mongodb+srv://iLoveJavaScript/test' , {
356+ serverSelectionTimeoutMS : 100
357+ } ) ;
358+
359+ const error = await client . connect ( ) . catch ( error => error ) ;
360+ expect ( error ) . to . be . instanceOf ( Error ) ;
361+ expect ( error . message ) . to . match ( / E N O T F O U N D / ) ;
362+ } ) ;
363+ } ) ;
364+
342365 it ( 'Should correctly pass through appname' , async function ( ) {
343366 const configuration = this . configuration ;
344367 const options = {
You can’t perform that action at this time.
0 commit comments