@@ -1118,13 +1118,10 @@ describe('Url SRV Parser', function() {
1118
1118
} ,
1119
1119
test : function ( done ) {
1120
1120
// This text record contains two options
1121
- // connectTimeoutMS=300000&socketTimeoutMS=300000
1122
1121
parse ( 'mongodb+srv://test5.test.build.10gen.cc' , { } , function ( err , object ) {
1123
- var serverOptions = {
1124
- socketOptions : { connectTimeoutMS : 300000 , socketTimeoutMS : 300000 }
1125
- } ;
1126
1122
expect ( err ) . to . be . null ;
1127
- expect ( object . server_options ) . to . deep . equal ( serverOptions ) ;
1123
+ expect ( object . rs_options . rs_name ) . to . equal ( 'repl0' ) ;
1124
+ expect ( object . db_options . authSource ) . to . equal ( 'thisDB' ) ;
1128
1125
done ( ) ;
1129
1126
} ) ;
1130
1127
}
@@ -1133,20 +1130,16 @@ describe('Url SRV Parser', function() {
1133
1130
/**
1134
1131
* @ignore
1135
1132
*/
1136
- it ( 'should build a connection string based on a SRV with multiple TXT records' , {
1133
+ it ( 'should fail if multiple TXT records' , {
1137
1134
metadata : {
1138
1135
requires : { topology : [ 'single' ] }
1139
1136
} ,
1140
1137
test : function ( done ) {
1141
1138
// This url has a text record with multiple records
1142
1139
// mongodb://localhost.build.10gen.cc:27017/?connectTimeoutMS=200000&socketTimeoutMS=200000
1143
1140
parse ( 'mongodb+srv://test6.test.build.10gen.cc' , { } , function ( err , object ) {
1144
- expect ( err ) . to . be . null ;
1145
- expect ( object ) . to . exist ;
1146
- expect ( object . servers [ 0 ] . host ) . to . equal ( 'localhost.test.build.10gen.cc' ) ;
1147
- expect ( object . servers [ 0 ] . port ) . to . equal ( 27017 ) ;
1148
- expect ( object . server_options . socketOptions . connectTimeoutMS ) . to . equal ( 200000 ) ;
1149
- expect ( object . server_options . socketOptions . socketTimeoutMS ) . to . equal ( 200000 ) ;
1141
+ expect ( err ) . to . exist ;
1142
+ expect ( err . message ) . to . equal ( 'multiple text records not allowed' ) ;
1150
1143
done ( ) ;
1151
1144
} ) ;
1152
1145
}
@@ -1155,11 +1148,13 @@ describe('Url SRV Parser', function() {
1155
1148
/**
1156
1149
* @ignore
1157
1150
*/
1158
- it ( 'should build a connection string based on SRV, TXT records and options override' , {
1151
+ it . skip ( 'should build a connection string based on SRV, TXT records and options override' , {
1159
1152
metadata : {
1160
1153
requires : { topology : [ 'single' ] }
1161
1154
} ,
1162
1155
test : function ( done ) {
1156
+ // TODO this url should error because of multiple text records but need a
1157
+ // test to check options override
1163
1158
// This url has srv and txt records and options passed in through api
1164
1159
parse ( 'mongodb+srv://test6.test.build.10gen.cc' , { connectTimeoutMS : 250000 } , function (
1165
1160
err ,
@@ -1189,10 +1184,10 @@ describe('Url SRV Parser', function() {
1189
1184
} ,
1190
1185
test : function ( done ) {
1191
1186
// This text record contains a key with no value
1192
- // readPreference
1187
+ // authSource
1193
1188
parse ( 'mongodb+srv://test8.test.build.10gen.cc' , { } , function ( err ) {
1194
1189
expect ( err ) . to . exist ;
1195
- expect ( err . message ) . to . equal ( 'query parameter readPreference is an incomplete value pair' ) ;
1190
+ expect ( err . message ) . to . equal ( 'query parameter authSource is an incomplete value pair' ) ;
1196
1191
done ( ) ;
1197
1192
} ) ;
1198
1193
}
@@ -1229,13 +1224,10 @@ describe('Url SRV Parser', function() {
1229
1224
} ,
1230
1225
test : function ( done ) {
1231
1226
// This text record contains multiple strings
1232
- // "connectTime" "outMS=150000" "&socketT" "imeoutMS" "=" "250000"
1227
+ // 'replicaS' 'et=rep' 'l0'
1233
1228
parse ( 'mongodb+srv://test11.test.build.10gen.cc' , function ( err , object ) {
1234
- var serverOptions = {
1235
- socketOptions : { connectTimeoutMS : 150000 , socketTimeoutMS : 250000 }
1236
- } ;
1237
1229
expect ( err ) . to . be . null ;
1238
- expect ( object . server_options ) . to . deep . equal ( serverOptions ) ;
1230
+ expect ( object . rs_options . rs_name ) . to . equal ( 'repl0' ) ;
1239
1231
done ( ) ;
1240
1232
} ) ;
1241
1233
}
0 commit comments