@@ -16,14 +16,17 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
16
16
const sandbox = sinon . createSandbox ( ) ;
17
17
let dataServiceStub ;
18
18
let getConnectionStringStub ;
19
+ let getLastSeenTopology ;
19
20
let instanceStub ;
20
21
21
22
before ( ( ) => {
22
23
getConnectionStringStub = sandbox . stub ( ) ;
24
+ getLastSeenTopology = sandbox . stub ( ) ;
23
25
instanceStub = sandbox . stub ( ) ;
24
26
dataServiceStub = {
25
27
getCurrentTopologyType : sandbox . stub ( ) ,
26
28
getConnectionString : getConnectionStringStub ,
29
+ getLastSeenTopology : getLastSeenTopology ,
27
30
instance : instanceStub ,
28
31
} as unknown as DataService ;
29
32
} ) ;
@@ -51,6 +54,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
51
54
getConnectionStringStub . returns (
52
55
new ConnectionString ( 'mongodb://13.64.151.161' )
53
56
) ;
57
+ getLastSeenTopology . returns ( {
58
+ servers : new Map ( ) . set ( '13.64.151.161' , {
59
+ address : '13.64.151.161' ,
60
+ } ) ,
61
+ } ) ;
54
62
55
63
const instanceTelemetry = await getConnectionTelemetryProperties (
56
64
dataServiceStub ,
@@ -80,6 +88,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
80
88
getConnectionStringStub . returns (
81
89
new ConnectionString ( 'mongodb://localhost:27017' )
82
90
) ;
91
+ getLastSeenTopology . returns ( {
92
+ servers : new Map ( ) . set ( 'localhost:27017' , {
93
+ address : 'localhost:27017' ,
94
+ } ) ,
95
+ } ) ;
83
96
84
97
const instanceTelemetry = await getConnectionTelemetryProperties (
85
98
dataServiceStub ,
@@ -111,6 +124,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
111
124
getConnectionStringStub . returns (
112
125
new ConnectionString ( 'mongodb://localhost:27017' )
113
126
) ;
127
+ getLastSeenTopology . returns ( {
128
+ servers : new Map ( ) . set ( 'localhost:27017' , {
129
+ address : 'localhost:27017' ,
130
+ } ) ,
131
+ } ) ;
114
132
115
133
const instanceTelemetry = await getConnectionTelemetryProperties (
116
134
dataServiceStub ,
@@ -145,6 +163,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
145
163
getConnectionStringStub . returns (
146
164
new ConnectionString ( 'mongodb://test-data-sets-a011bb.mongodb.net' )
147
165
) ;
166
+ getLastSeenTopology . returns ( {
167
+ servers : new Map ( ) . set ( 'test-data-sets-00-02-a011bb.mongodb.net' , {
168
+ address : 'test-data-sets-00-02-a011bb.mongodb.net' ,
169
+ } ) ,
170
+ } ) ;
148
171
149
172
const instanceTelemetry = await getConnectionTelemetryProperties (
150
173
dataServiceStub ,
@@ -153,7 +176,7 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
153
176
154
177
expect ( instanceTelemetry . is_atlas ) . to . equal ( true ) ;
155
178
expect ( instanceTelemetry . atlas_hostname ) . to . equal (
156
- 'test-data-sets-a011bb.mongodb.net'
179
+ 'test-data-sets-00-02- a011bb.mongodb.net'
157
180
) ;
158
181
expect ( instanceTelemetry . is_atlas_url ) . to . equal ( true ) ;
159
182
expect ( instanceTelemetry . is_local_atlas ) . to . equal ( false ) ;
@@ -178,6 +201,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
178
201
getConnectionStringStub . returns (
179
202
new ConnectionString ( 'mongodb://example.mongo.ondigitalocean.com:27017' )
180
203
) ;
204
+ getLastSeenTopology . returns ( {
205
+ servers : new Map ( ) . set ( 'example.mongo.ondigitalocean.com:27017' , {
206
+ address : 'example.mongo.ondigitalocean.com:27017' ,
207
+ } ) ,
208
+ } ) ;
181
209
182
210
const instanceTelemetry = await getConnectionTelemetryProperties (
183
211
dataServiceStub ,
@@ -209,6 +237,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
209
237
getConnectionStringStub . returns (
210
238
new ConnectionString ( 'mongodb://localhost:27017' )
211
239
) ;
240
+ getLastSeenTopology . returns ( {
241
+ servers : new Map ( ) . set ( 'localhost:27017' , {
242
+ address : 'localhost:27017' ,
243
+ } ) ,
244
+ } ) ;
212
245
213
246
const instanceTelemetry = await getConnectionTelemetryProperties (
214
247
dataServiceStub ,
@@ -239,6 +272,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
239
272
getConnectionStringStub . returns (
240
273
new ConnectionString ( 'mongodb://localhost:27017' )
241
274
) ;
275
+ getLastSeenTopology . returns ( {
276
+ servers : new Map ( ) . set ( 'localhost:27017' , {
277
+ address : 'localhost:27017' ,
278
+ } ) ,
279
+ } ) ;
242
280
243
281
const instanceTelemetry = await getConnectionTelemetryProperties (
244
282
dataServiceStub ,
@@ -269,6 +307,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
269
307
getConnectionStringStub . returns (
270
308
new ConnectionString ( 'mongodb://localhost:27017' )
271
309
) ;
310
+ getLastSeenTopology . returns ( {
311
+ servers : new Map ( ) . set ( 'localhost:27017' , {
312
+ address : 'localhost:27017' ,
313
+ } ) ,
314
+ } ) ;
272
315
273
316
const instanceTelemetry = await getConnectionTelemetryProperties (
274
317
dataServiceStub ,
@@ -299,6 +342,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
299
342
getConnectionStringStub . returns (
300
343
new ConnectionString ( 'mongodb://example.mongo.ondigitalocean.com:27017' )
301
344
) ;
345
+ getLastSeenTopology . returns ( {
346
+ servers : new Map ( ) . set ( 'example.mongo.ondigitalocean.com:27017' , {
347
+ address : 'example.mongo.ondigitalocean.com:27017' ,
348
+ } ) ,
349
+ } ) ;
302
350
303
351
const instanceTelemetry = await getConnectionTelemetryProperties (
304
352
dataServiceStub ,
@@ -327,6 +375,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
327
375
getConnectionStringStub . returns (
328
376
new ConnectionString ( 'mongodb://localhost:27017' )
329
377
) ;
378
+ getLastSeenTopology . returns ( {
379
+ servers : new Map ( ) . set ( 'localhost:27017' , {
380
+ address : 'localhost:27017' ,
381
+ } ) ,
382
+ } ) ;
330
383
331
384
const instanceTelemetry = await getConnectionTelemetryProperties (
332
385
dataServiceStub ,
@@ -361,6 +414,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
361
414
getConnectionStringStub . returns (
362
415
new ConnectionString ( 'mongodb://127.0.0.1' )
363
416
) ;
417
+ getLastSeenTopology . returns ( {
418
+ servers : new Map ( ) . set ( '127.0.0.1' , {
419
+ address : '127.0.0.1' ,
420
+ } ) ,
421
+ } ) ;
364
422
365
423
const instanceTelemetry = await getConnectionTelemetryProperties (
366
424
dataServiceStub ,
@@ -397,6 +455,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
397
455
getConnectionStringStub . returns (
398
456
new ConnectionString ( 'mongodb://127.0.0.1' )
399
457
) ;
458
+ getLastSeenTopology . returns ( {
459
+ servers : new Map ( ) . set ( '127.0.0.1' , {
460
+ address : '127.0.0.1' ,
461
+ } ) ,
462
+ } ) ;
400
463
401
464
const instanceTelemetry = await getConnectionTelemetryProperties (
402
465
dataServiceStub ,
@@ -427,6 +490,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
427
490
getConnectionStringStub . returns (
428
491
new ConnectionString ( 'mongodb://artishok:pass@localhost:27017' )
429
492
) ;
493
+ getLastSeenTopology . returns ( {
494
+ servers : new Map ( ) . set ( 'localhost:27017' , {
495
+ address : 'localhost:27017' ,
496
+ } ) ,
497
+ } ) ;
430
498
431
499
const instanceTelemetry = await getConnectionTelemetryProperties (
432
500
dataServiceStub ,
@@ -455,6 +523,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
455
523
getConnectionStringStub . returns (
456
524
new ConnectionString ( 'mongodb://localhost:27017' )
457
525
) ;
526
+ getLastSeenTopology . returns ( {
527
+ servers : new Map ( ) . set ( 'localhost:27017' , {
528
+ address : 'localhost:27017' ,
529
+ } ) ,
530
+ } ) ;
458
531
459
532
const instanceTelemetry = await getConnectionTelemetryProperties (
460
533
dataServiceStub ,
@@ -485,6 +558,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
485
558
'mongodb://foo:bar@localhost:27017/?authSource=source&authMechanism=SCRAM-SHA-1'
486
559
)
487
560
) ;
561
+ getLastSeenTopology . returns ( {
562
+ servers : new Map ( ) . set ( 'localhost:27017' , {
563
+ address : 'localhost:27017' ,
564
+ } ) ,
565
+ } ) ;
488
566
489
567
const instanceTelemetry = await getConnectionTelemetryProperties (
490
568
dataServiceStub ,
0 commit comments