@@ -16,14 +16,17 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
1616 const sandbox = sinon . createSandbox ( ) ;
1717 let dataServiceStub ;
1818 let getConnectionStringStub ;
19+ let getLastSeenTopology ;
1920 let instanceStub ;
2021
2122 before ( ( ) => {
2223 getConnectionStringStub = sandbox . stub ( ) ;
24+ getLastSeenTopology = sandbox . stub ( ) ;
2325 instanceStub = sandbox . stub ( ) ;
2426 dataServiceStub = {
2527 getCurrentTopologyType : sandbox . stub ( ) ,
2628 getConnectionString : getConnectionStringStub ,
29+ getLastSeenTopology : getLastSeenTopology ,
2730 instance : instanceStub ,
2831 } as unknown as DataService ;
2932 } ) ;
@@ -51,6 +54,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
5154 getConnectionStringStub . returns (
5255 new ConnectionString ( 'mongodb://13.64.151.161' )
5356 ) ;
57+ getLastSeenTopology . returns ( {
58+ servers : new Map ( ) . set ( '13.64.151.161' , {
59+ address : '13.64.151.161' ,
60+ } ) ,
61+ } ) ;
5462
5563 const instanceTelemetry = await getConnectionTelemetryProperties (
5664 dataServiceStub ,
@@ -80,6 +88,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
8088 getConnectionStringStub . returns (
8189 new ConnectionString ( 'mongodb://localhost:27017' )
8290 ) ;
91+ getLastSeenTopology . returns ( {
92+ servers : new Map ( ) . set ( 'localhost:27017' , {
93+ address : 'localhost:27017' ,
94+ } ) ,
95+ } ) ;
8396
8497 const instanceTelemetry = await getConnectionTelemetryProperties (
8598 dataServiceStub ,
@@ -111,6 +124,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
111124 getConnectionStringStub . returns (
112125 new ConnectionString ( 'mongodb://localhost:27017' )
113126 ) ;
127+ getLastSeenTopology . returns ( {
128+ servers : new Map ( ) . set ( 'localhost:27017' , {
129+ address : 'localhost:27017' ,
130+ } ) ,
131+ } ) ;
114132
115133 const instanceTelemetry = await getConnectionTelemetryProperties (
116134 dataServiceStub ,
@@ -145,6 +163,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
145163 getConnectionStringStub . returns (
146164 new ConnectionString ( 'mongodb://test-data-sets-a011bb.mongodb.net' )
147165 ) ;
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+ } ) ;
148171
149172 const instanceTelemetry = await getConnectionTelemetryProperties (
150173 dataServiceStub ,
@@ -153,7 +176,7 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
153176
154177 expect ( instanceTelemetry . is_atlas ) . to . equal ( true ) ;
155178 expect ( instanceTelemetry . atlas_hostname ) . to . equal (
156- 'test-data-sets-a011bb.mongodb.net'
179+ 'test-data-sets-00-02- a011bb.mongodb.net'
157180 ) ;
158181 expect ( instanceTelemetry . is_atlas_url ) . to . equal ( true ) ;
159182 expect ( instanceTelemetry . is_local_atlas ) . to . equal ( false ) ;
@@ -178,6 +201,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
178201 getConnectionStringStub . returns (
179202 new ConnectionString ( 'mongodb://example.mongo.ondigitalocean.com:27017' )
180203 ) ;
204+ getLastSeenTopology . returns ( {
205+ servers : new Map ( ) . set ( 'example.mongo.ondigitalocean.com:27017' , {
206+ address : 'example.mongo.ondigitalocean.com:27017' ,
207+ } ) ,
208+ } ) ;
181209
182210 const instanceTelemetry = await getConnectionTelemetryProperties (
183211 dataServiceStub ,
@@ -209,6 +237,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
209237 getConnectionStringStub . returns (
210238 new ConnectionString ( 'mongodb://localhost:27017' )
211239 ) ;
240+ getLastSeenTopology . returns ( {
241+ servers : new Map ( ) . set ( 'localhost:27017' , {
242+ address : 'localhost:27017' ,
243+ } ) ,
244+ } ) ;
212245
213246 const instanceTelemetry = await getConnectionTelemetryProperties (
214247 dataServiceStub ,
@@ -239,6 +272,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
239272 getConnectionStringStub . returns (
240273 new ConnectionString ( 'mongodb://localhost:27017' )
241274 ) ;
275+ getLastSeenTopology . returns ( {
276+ servers : new Map ( ) . set ( 'localhost:27017' , {
277+ address : 'localhost:27017' ,
278+ } ) ,
279+ } ) ;
242280
243281 const instanceTelemetry = await getConnectionTelemetryProperties (
244282 dataServiceStub ,
@@ -269,6 +307,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
269307 getConnectionStringStub . returns (
270308 new ConnectionString ( 'mongodb://localhost:27017' )
271309 ) ;
310+ getLastSeenTopology . returns ( {
311+ servers : new Map ( ) . set ( 'localhost:27017' , {
312+ address : 'localhost:27017' ,
313+ } ) ,
314+ } ) ;
272315
273316 const instanceTelemetry = await getConnectionTelemetryProperties (
274317 dataServiceStub ,
@@ -299,6 +342,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
299342 getConnectionStringStub . returns (
300343 new ConnectionString ( 'mongodb://example.mongo.ondigitalocean.com:27017' )
301344 ) ;
345+ getLastSeenTopology . returns ( {
346+ servers : new Map ( ) . set ( 'example.mongo.ondigitalocean.com:27017' , {
347+ address : 'example.mongo.ondigitalocean.com:27017' ,
348+ } ) ,
349+ } ) ;
302350
303351 const instanceTelemetry = await getConnectionTelemetryProperties (
304352 dataServiceStub ,
@@ -327,6 +375,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
327375 getConnectionStringStub . returns (
328376 new ConnectionString ( 'mongodb://localhost:27017' )
329377 ) ;
378+ getLastSeenTopology . returns ( {
379+ servers : new Map ( ) . set ( 'localhost:27017' , {
380+ address : 'localhost:27017' ,
381+ } ) ,
382+ } ) ;
330383
331384 const instanceTelemetry = await getConnectionTelemetryProperties (
332385 dataServiceStub ,
@@ -361,6 +414,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
361414 getConnectionStringStub . returns (
362415 new ConnectionString ( 'mongodb://127.0.0.1' )
363416 ) ;
417+ getLastSeenTopology . returns ( {
418+ servers : new Map ( ) . set ( '127.0.0.1' , {
419+ address : '127.0.0.1' ,
420+ } ) ,
421+ } ) ;
364422
365423 const instanceTelemetry = await getConnectionTelemetryProperties (
366424 dataServiceStub ,
@@ -397,6 +455,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
397455 getConnectionStringStub . returns (
398456 new ConnectionString ( 'mongodb://127.0.0.1' )
399457 ) ;
458+ getLastSeenTopology . returns ( {
459+ servers : new Map ( ) . set ( '127.0.0.1' , {
460+ address : '127.0.0.1' ,
461+ } ) ,
462+ } ) ;
400463
401464 const instanceTelemetry = await getConnectionTelemetryProperties (
402465 dataServiceStub ,
@@ -427,6 +490,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
427490 getConnectionStringStub . returns (
428491 new ConnectionString ( 'mongodb://artishok:pass@localhost:27017' )
429492 ) ;
493+ getLastSeenTopology . returns ( {
494+ servers : new Map ( ) . set ( 'localhost:27017' , {
495+ address : 'localhost:27017' ,
496+ } ) ,
497+ } ) ;
430498
431499 const instanceTelemetry = await getConnectionTelemetryProperties (
432500 dataServiceStub ,
@@ -455,6 +523,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
455523 getConnectionStringStub . returns (
456524 new ConnectionString ( 'mongodb://localhost:27017' )
457525 ) ;
526+ getLastSeenTopology . returns ( {
527+ servers : new Map ( ) . set ( 'localhost:27017' , {
528+ address : 'localhost:27017' ,
529+ } ) ,
530+ } ) ;
458531
459532 const instanceTelemetry = await getConnectionTelemetryProperties (
460533 dataServiceStub ,
@@ -485,6 +558,11 @@ suite('ConnectionTelemetry Controller Test Suite', function () {
485558 'mongodb://foo:bar@localhost:27017/?authSource=source&authMechanism=SCRAM-SHA-1'
486559 )
487560 ) ;
561+ getLastSeenTopology . returns ( {
562+ servers : new Map ( ) . set ( 'localhost:27017' , {
563+ address : 'localhost:27017' ,
564+ } ) ,
565+ } ) ;
488566
489567 const instanceTelemetry = await getConnectionTelemetryProperties (
490568 dataServiceStub ,
0 commit comments