@@ -10,7 +10,7 @@ var parse = require('../../lib/url_parser');
10
10
*/
11
11
exports [ 'Should correctly parse mongodb://localhost' ] = {
12
12
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
13
-
13
+
14
14
// The actual test we wish to run
15
15
test : function ( configure , test ) {
16
16
// console.dir(parse)
@@ -28,7 +28,7 @@ exports['Should correctly parse mongodb://localhost'] = {
28
28
*/
29
29
exports [ 'Should correctly parse mongodb://localhost:27017' ] = {
30
30
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
31
-
31
+
32
32
// The actual test we wish to run
33
33
test : function ( configure , test ) {
34
34
// console.dir(parse)
@@ -46,7 +46,7 @@ exports['Should correctly parse mongodb://localhost:27017'] = {
46
46
*/
47
47
exports [ 'Should correctly parse mongodb://localhost?safe=true&readPreference=secondary' ] = {
48
48
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
49
-
49
+
50
50
// The actual test we wish to run
51
51
test : function ( configure , test ) {
52
52
// console.dir(parse)
@@ -65,7 +65,7 @@ exports['Should correctly parse mongodb://localhost?safe=true&readPreference=sec
65
65
*/
66
66
exports [ 'Should correctly parse mongodb://localhost:28101' ] = {
67
67
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
68
-
68
+
69
69
// The actual test we wish to run
70
70
test : function ( configure , test ) {
71
71
// console.dir(parse)
@@ -83,7 +83,7 @@ exports['Should correctly parse mongodb://localhost:28101'] = {
83
83
*/
84
84
exports [ 'Should correctly parse mongodb://fred:foobar@localhost/baz' ] = {
85
85
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
86
-
86
+
87
87
// The actual test we wish to run
88
88
test : function ( configure , test ) {
89
89
// console.dir(parse)
@@ -103,7 +103,7 @@ exports['Should correctly parse mongodb://fred:foobar@localhost/baz'] = {
103
103
*/
104
104
exports [ 'Should correctly parse mongodb://fred:foo%20bar@localhost/baz' ] = {
105
105
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
106
-
106
+
107
107
// The actual test we wish to run
108
108
test : function ( configure , test ) {
109
109
// console.dir(parse)
@@ -123,7 +123,7 @@ exports['Should correctly parse mongodb://fred:foo%20bar@localhost/baz'] = {
123
123
*/
124
124
exports [ 'Should correctly parse mongodb:///tmp/mongodb-27017.sock' ] = {
125
125
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
126
-
126
+
127
127
// The actual test we wish to run
128
128
test : function ( configure , test ) {
129
129
// console.dir(parse)
@@ -140,7 +140,7 @@ exports['Should correctly parse mongodb:///tmp/mongodb-27017.sock'] = {
140
140
*/
141
141
exports [ 'Should correctly parse mongodb://fred:foo@/tmp/mongodb-27017.sock' ] = {
142
142
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
143
-
143
+
144
144
// The actual test we wish to run
145
145
test : function ( configure , test ) {
146
146
// console.dir(parse)
@@ -159,7 +159,7 @@ exports['Should correctly parse mongodb://fred:foo@/tmp/mongodb-27017.sock'] = {
159
159
*/
160
160
exports [ 'Should correctly parse mongodb://fred:foo@/tmp/mongodb-27017.sock/somedb' ] = {
161
161
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
162
-
162
+
163
163
// The actual test we wish to run
164
164
test : function ( configure , test ) {
165
165
// console.dir(parse)
@@ -178,7 +178,7 @@ exports['Should correctly parse mongodb://fred:foo@/tmp/mongodb-27017.sock/somed
178
178
*/
179
179
exports [ 'Should correctly parse mongodb://fred:foo@/tmp/mongodb-27017.sock/somedb?safe=true' ] = {
180
180
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
181
-
181
+
182
182
// The actual test we wish to run
183
183
test : function ( configure , test ) {
184
184
// console.dir(parse)
@@ -198,7 +198,7 @@ exports['Should correctly parse mongodb://fred:foo@/tmp/mongodb-27017.sock/somed
198
198
*/
199
199
exports [ 'Should correctly parse mongodb://example1.com:27017,example2.com:27018' ] = {
200
200
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
201
-
201
+
202
202
// The actual test we wish to run
203
203
test : function ( configure , test ) {
204
204
// console.dir(parse)
@@ -218,7 +218,7 @@ exports['Should correctly parse mongodb://example1.com:27017,example2.com:27018'
218
218
*/
219
219
exports [ 'Should correctly parse mongodb://localhost,localhost:27018,localhost:27019' ] = {
220
220
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
221
-
221
+
222
222
// The actual test we wish to run
223
223
test : function ( configure , test ) {
224
224
// console.dir(parse)
@@ -240,7 +240,7 @@ exports['Should correctly parse mongodb://localhost,localhost:27018,localhost:27
240
240
*/
241
241
exports [ 'Should correctly parse mongodb://host1,host2,host3/?slaveOk=true' ] = {
242
242
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
243
-
243
+
244
244
// The actual test we wish to run
245
245
test : function ( configure , test ) {
246
246
// console.dir(parse)
@@ -258,12 +258,35 @@ exports['Should correctly parse mongodb://host1,host2,host3/?slaveOk=true'] = {
258
258
}
259
259
}
260
260
261
+ /**
262
+ * @ignore
263
+ */
264
+ exports [ 'Should correctly parse mongodb://host1,host2,host3,host1/?slaveOk=true and de-duplicate names' ] = {
265
+ metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
266
+
267
+ // The actual test we wish to run
268
+ test : function ( configure , test ) {
269
+ // console.dir(parse)
270
+ var object = parse ( "mongodb://host1,host2,host3,host1/?slaveOk=true" ) ;
271
+ test . equal ( 3 , object . servers . length ) ;
272
+ test . equal ( "host1" , object . servers [ 0 ] . host ) ;
273
+ test . equal ( '27017' , object . servers [ 0 ] . port ) ;
274
+ test . equal ( "host2" , object . servers [ 1 ] . host ) ;
275
+ test . equal ( '27017' , object . servers [ 1 ] . port ) ;
276
+ test . equal ( "host3" , object . servers [ 2 ] . host ) ;
277
+ test . equal ( '27017' , object . servers [ 2 ] . port ) ;
278
+ test . equal ( 'admin' , object . dbName ) ;
279
+ test . equal ( true , object . server_options . slave_ok ) ;
280
+ test . done ( ) ;
281
+ }
282
+ }
283
+
261
284
/**
262
285
* @ignore
263
286
*/
264
287
exports [ 'Should correctly parse mongodb://localhost/?safe=true' ] = {
265
288
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
266
-
289
+
267
290
// The actual test we wish to run
268
291
test : function ( configure , test ) {
269
292
// console.dir(parse)
@@ -282,7 +305,7 @@ exports['Should correctly parse mongodb://localhost/?safe=true'] = {
282
305
*/
283
306
exports [ 'Should correctly parse mongodb://host1,host2,host3/?safe=true;w=2;wtimeoutMS=2000' ] = {
284
307
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
285
-
308
+
286
309
// The actual test we wish to run
287
310
test : function ( configure , test ) {
288
311
// console.dir(parse)
@@ -307,7 +330,7 @@ exports['Should correctly parse mongodb://host1,host2,host3/?safe=true;w=2;wtime
307
330
*/
308
331
exports [ 'Parse mongodb://localhost/db?replicaSet=hello&ssl=prefer&connectTimeoutMS=1000&socketTimeoutMS=2000' ] = {
309
332
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
310
-
333
+
311
334
// The actual test we wish to run
312
335
test : function ( configure , test ) {
313
336
// console.dir(parse)
@@ -332,7 +355,7 @@ exports['Parse mongodb://localhost/db?replicaSet=hello&ssl=prefer&connectTimeout
332
355
*/
333
356
exports [ 'Parse mongodb://localhost/db?ssl=true' ] = {
334
357
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
335
-
358
+
336
359
// The actual test we wish to run
337
360
test : function ( configure , test ) {
338
361
// console.dir(parse)
@@ -352,7 +375,7 @@ exports['Parse mongodb://localhost/db?ssl=true'] = {
352
375
*/
353
376
exports [ 'Parse mongodb://localhost/db?maxPoolSize=100' ] = {
354
377
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
355
-
378
+
356
379
// The actual test we wish to run
357
380
test : function ( configure , test ) {
358
381
// console.dir(parse)
@@ -372,7 +395,7 @@ exports['Parse mongodb://localhost/db?maxPoolSize=100'] = {
372
395
*/
373
396
exports [ 'Parse mongodb://localhost/db?w=-1' ] = {
374
397
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
375
-
398
+
376
399
// The actual test we wish to run
377
400
test : function ( configure , test ) {
378
401
// console.dir(parse)
@@ -391,7 +414,7 @@ exports['Parse mongodb://localhost/db?w=-1'] = {
391
414
*/
392
415
exports [ 'Throw on unsuported options' ] = {
393
416
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
394
-
417
+
395
418
// The actual test we wish to run
396
419
test : function ( configure , test ) {
397
420
// console.dir(parse)
@@ -409,7 +432,7 @@ exports['Throw on unsuported options'] = {
409
432
*/
410
433
exports [ 'Write concerns parsing' ] = {
411
434
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
412
-
435
+
413
436
// The actual test we wish to run
414
437
test : function ( configure , test ) {
415
438
var object = parse ( "mongodb://localhost/db?safe=true&w=1" ) ;
@@ -430,7 +453,7 @@ exports['Write concerns parsing'] = {
430
453
*/
431
454
exports [ 'GSSAPI parsing' ] = {
432
455
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
433
-
456
+
434
457
// The actual test we wish to run
435
458
test : function ( configure , test ) {
436
459
var object = parse ( "mongodb://dev1%[email protected] /test?authMechanism=GSSAPI" ) ;
@@ -463,7 +486,7 @@ exports['GSSAPI parsing'] = {
463
486
*/
464
487
exports [ 'Read preferences parsing' ] = {
465
488
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
466
-
489
+
467
490
// The actual test we wish to run
468
491
test : function ( configure , test ) {
469
492
var object = parse ( "mongodb://localhost/db?slaveOk=true" ) ;
@@ -497,7 +520,7 @@ exports['Read preferences parsing'] = {
497
520
*/
498
521
exports [ 'Read preferences tag parsing' ] = {
499
522
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
500
-
523
+
501
524
// The actual test we wish to run
502
525
test : function ( configure , test ) {
503
526
var object = parse ( "mongodb://localhost/db" ) ;
@@ -523,7 +546,7 @@ exports['Read preferences tag parsing'] = {
523
546
*/
524
547
exports [ 'Should correctly parse mongodb://[::1]:1234' ] = {
525
548
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
526
-
549
+
527
550
// The actual test we wish to run
528
551
test : function ( configure , test ) {
529
552
// console.dir(parse)
@@ -541,7 +564,7 @@ exports['Should correctly parse mongodb://[::1]:1234'] = {
541
564
*/
542
565
exports [ 'Should correctly parse mongodb://[::1]' ] = {
543
566
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
544
-
567
+
545
568
// The actual test we wish to run
546
569
test : function ( configure , test ) {
547
570
// console.dir(parse)
@@ -559,7 +582,7 @@ exports['Should correctly parse mongodb://[::1]'] = {
559
582
*/
560
583
exports [ 'Should correctly parse mongodb://localhost,[::1]:27018,[2607:f0d0:1002:51::41]' ] = {
561
584
metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
562
-
585
+
563
586
// The actual test we wish to run
564
587
test : function ( configure , test ) {
565
588
// console.dir(parse)
@@ -574,4 +597,4 @@ exports['Should correctly parse mongodb://localhost,[::1]:27018,[2607:f0d0:1002:
574
597
test . equal ( 'admin' , object . dbName ) ;
575
598
test . done ( ) ;
576
599
}
577
- }
600
+ }
0 commit comments