1
- import { expect } from 'chai' ;
1
+ /* eslint-disable @typescript-eslint/no-empty-function */
2
+
2
3
import { type TestConfiguration } from '../../tools/runner/config' ;
3
4
import { runScriptAndGetProcessInfo } from './resource_tracking_script_builder' ;
4
5
5
- describe ( 'MongoClient.close() Integration' , ( ) => {
6
+ describe . skip ( 'MongoClient.close() Integration' , ( ) => {
6
7
// note: these tests are set-up in accordance of the resource ownership tree
7
8
8
9
let config : TestConfiguration ;
@@ -32,23 +33,9 @@ describe('MongoClient.close() Integration', () => {
32
33
} ) ;
33
34
34
35
describe ( 'Node.js resource: .dockerenv file access' , ( ) => {
35
- describe ( 'when client is connecting and reads an infinite .dockerenv file' , ( ) => {
36
- it ( 'the file read is not interrupted by client.close()' , async function ( ) {
37
- await runScriptAndGetProcessInfo (
38
- 'docker-file-access' ,
39
- config ,
40
- async function run ( { MongoClient, uri, log, chai } ) {
41
- // TODO: unsure how to make a /.dockerenv fs access read hang
42
- const client = this . configuration . newClient ( ) ;
43
- client . connect ( ) ;
44
- // assert resource exists
45
- chai . expect ( process . getActiveResourcesInfo ( ) ) . to . contain ( 'FSReqPromise' ) ;
46
- await client . close ( ) ;
47
- // assert resource still exists
48
- chai . expect ( process . getActiveResourcesInfo ( ) ) . to . contain ( 'FSReqPromise' ) ;
49
- }
50
- ) ;
51
- } ) ;
36
+ describe ( 'when client is connecting and fs.access stalls while accessing .dockerenv file' , ( ) => {
37
+ it ( 'the file access is not interrupted by client.close()' , async function ( ) { } ) . skipReason =
38
+ 'TODO(NODE-6624): Align Client.Close Test Cases with Finalized Design' ;
52
39
} ) ;
53
40
} ) ;
54
41
@@ -63,7 +50,7 @@ describe('MongoClient.close() Integration', () => {
63
50
const infiniteFile = '/dev/zero' ;
64
51
log ( { ActiveResources : process . getActiveResourcesInfo ( ) } ) ;
65
52
66
- // speculative authentication call to getToken() during initial handshake
53
+ // speculative authentication call to getToken() is during initial handshake
67
54
const client = new MongoClient ( uri , {
68
55
authMechanismProperties : { TOKEN_RESOURCE : infiniteFile }
69
56
} ) ;
@@ -85,17 +72,7 @@ describe('MongoClient.close() Integration', () => {
85
72
describe ( 'Topology' , ( ) => {
86
73
describe ( 'Node.js resource: Server Selection Timer' , ( ) => {
87
74
describe ( 'after a Topology is created through client.connect()' , ( ) => {
88
- it ( 'server selection timers are cleaned up by client.close()' , async ( ) => {
89
- await runScriptAndGetProcessInfo (
90
- 'server-selection-timers' ,
91
- config ,
92
- async function run ( { MongoClient, uri } ) {
93
- const client = new MongoClient ( uri ) ;
94
- client . connect ( ) ;
95
- await client . close ( ) ;
96
- }
97
- ) ;
98
- } ) ;
75
+ it ( 'server selection timers are cleaned up by client.close()' , async ( ) => { } ) ;
99
76
} ) ;
100
77
} ) ;
101
78
@@ -122,43 +99,11 @@ describe('MongoClient.close() Integration', () => {
122
99
123
100
describe ( 'Connection Monitoring' , ( ) => {
124
101
describe ( 'Node.js resource: Socket' , ( ) => {
125
- it . only ( 'no sockets remain after client.close()' , metadata , async function ( ) {
126
- await runScriptAndGetProcessInfo (
127
- 'socket-connection-monitoring' ,
128
- config ,
129
- async function run ( { MongoClient, uri, log, chai } ) {
130
- const client = new MongoClient ( uri , { serverMonitoringMode : 'auto' } ) ;
131
- await client . connect ( ) ;
132
-
133
- // returns all active tcp endpoints
134
- const connectionMonitoringReport = ( ) => process . report . getReport ( ) . libuv . filter ( r => r . type === 'tcp' && r . is_active ) . map ( r => r . remoteEndpoint ) ;
135
-
136
- log ( { report : connectionMonitoringReport ( ) } ) ;
137
- // assert socket creation
138
- const servers = client . topology ?. s . servers ;
139
- for ( const server of servers ) {
140
- let { host, port } = server [ 1 ] . s . description . hostAddress ;
141
- // regardless of if its active the socket should be gone from the libuv report
142
-
143
- chai . expect ( connectionMonitoringReport ( ) ) . to . deep . include ( { host, port } ) ;
144
- }
145
-
146
- await client . close ( ) ;
147
-
148
- // assert socket destruction
149
- for ( const server of servers ) {
150
- let { host, port } = server [ 1 ] . s . description . hostAddress ;
151
- chai . expect ( connectionMonitoringReport ( ) ) . to . not . deep . include ( { host, port } ) ;
152
- }
153
- }
154
- ) ;
155
- } ) ;
102
+ it ( 'no sockets remain after client.close()' , metadata , async function ( ) { } ) ;
156
103
} ) ;
157
104
158
105
describe ( 'Server resource: connection thread' , ( ) => {
159
- it ( 'no connection threads remain after client.close()' , metadata , async ( ) => {
160
- // TODO: skip for LB mode
161
- } ) ;
106
+ it ( 'no connection threads remain after client.close()' , metadata , async ( ) => { } ) ;
162
107
} ) ;
163
108
} ) ;
164
109
@@ -174,35 +119,7 @@ describe('MongoClient.close() Integration', () => {
174
119
describe ( 'Connection' , ( ) => {
175
120
describe ( 'Node.js resource: Socket' , ( ) => {
176
121
describe ( 'when rtt monitoring is turned on' , ( ) => {
177
- it ( 'no sockets remain after client.close()' , async ( ) => {
178
- await runScriptAndGetProcessInfo (
179
- 'socket-rtt-monitoring' ,
180
- config ,
181
- async function run ( { MongoClient, uri, log, chai } ) {
182
- const client = new MongoClient ( uri ) ;
183
- await client . connect ( ) ;
184
-
185
- // returns all active tcp endpoints
186
- const connectionMonitoringReport = ( ) => process . report . getReport ( ) . libuv . filter ( r => r . type === 'tcp' && r . is_active ) . map ( r => r . remoteEndpoint ) ;
187
-
188
- // assert socket creation
189
- const servers = client . topology ?. s . servers ;
190
- for ( const server of servers ) {
191
- let { host, port } = server [ 1 ] . s . description . hostAddress ;
192
- // regardless of if its active the socket should be gone from the libuv report
193
- chai . expect ( connectionMonitoringReport ( ) ) . to . deep . include ( { host, port } ) ;
194
- }
195
-
196
- await client . close ( ) ;
197
-
198
- // assert socket destruction
199
- for ( const server of servers ) {
200
- let { host, port } = server [ 1 ] . s . description . hostAddress ;
201
- chai . expect ( connectionMonitoringReport ( ) ) . to . not . deep . include ( { host, port } ) ;
202
- }
203
- }
204
- ) ;
205
- } ) ;
122
+ it ( 'no sockets remain after client.close()' , async ( ) => { } ) ;
206
123
} ) ;
207
124
} ) ;
208
125
@@ -256,17 +173,7 @@ describe('MongoClient.close() Integration', () => {
256
173
describe ( 'SrvPoller' , ( ) => {
257
174
describe ( 'Node.js resource: Timer' , ( ) => {
258
175
describe ( 'after SRVPoller is created' , ( ) => {
259
- it ( 'timers are cleaned up by client.close()' , async ( ) => {
260
- await runScriptAndGetProcessInfo (
261
- 'srv-poller' ,
262
- config ,
263
- async function run ( { MongoClient, uri } ) {
264
- const client = new MongoClient ( uri ) ;
265
- await client . connect ( ) ;
266
- await client . close ( ) ;
267
- }
268
- ) ;
269
- } ) ;
176
+ it ( 'timers are cleaned up by client.close()' , async ( ) => { } ) ;
270
177
} ) ;
271
178
} ) ;
272
179
} ) ;
@@ -398,54 +305,7 @@ describe('MongoClient.close() Integration', () => {
398
305
} ) ;
399
306
400
307
describe ( 'Node.js resource: Socket' , ( ) => {
401
- it ( 'no sockets remain after client.close()' , metadata , async ( ) => {
402
- await runScriptAndGetProcessInfo (
403
- 'tls-file-read' ,
404
- config ,
405
- async function run ( { MongoClient, uri, log, chai, ClientEncryption, BSON } ) {
406
- const kmsProviders = BSON . EJSON . parse ( process . env . CSFLE_KMS_PROVIDERS ) ;
407
- const masterKey = {
408
- region : 'us-east-1' ,
409
- key : 'arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0'
410
- } ;
411
- const provider = 'aws' ;
412
-
413
- const keyVaultClient = new MongoClient ( uri ) ;
414
- await keyVaultClient . connect ( ) ;
415
-
416
- await keyVaultClient . db ( 'keyvault' ) . collection ( 'datakeys' ) ;
417
- const clientEncryption = new ClientEncryption ( keyVaultClient , {
418
- keyVaultNamespace : 'keyvault.datakeys' ,
419
- kmsProviders
420
- } ) ;
421
-
422
- const socketIdCache = process . report
423
- . getReport ( )
424
- . libuv . filter ( r => r . type === 'tcp' )
425
- . map ( r => r . address ) ;
426
- log ( { socketIdCache } ) ;
427
-
428
- // runs KMS request
429
- const dataKey = await clientEncryption
430
- . createDataKey ( provider , { masterKey } )
431
- . catch ( e => e ) ;
432
-
433
- const newSocketsBeforeClose = process . report
434
- . getReport ( )
435
- . libuv . filter ( r => ! socketIdCache . includes ( r . address ) && r . type === 'tcp' ) ;
436
- log ( { newSocketsBeforeClose } ) ;
437
- chai . expect ( newSocketsBeforeClose ) . to . have . length . gte ( 1 ) ;
438
-
439
- await keyVaultClient . close ( ) ;
440
-
441
- const newSocketsAfterClose = process . report
442
- . getReport ( )
443
- . libuv . filter ( r => ! socketIdCache . includes ( r . address ) && r . type === 'tcp' ) ;
444
- log ( { newSocketsAfterClose } ) ;
445
- chai . expect ( newSocketsAfterClose ) . to . be . empty ;
446
- }
447
- ) ;
448
- } ) ;
308
+ it ( 'no sockets remain after client.close()' , metadata , async ( ) => { } ) ;
449
309
} ) ;
450
310
} ) ;
451
311
} ) ;
@@ -499,54 +359,7 @@ describe('MongoClient.close() Integration', () => {
499
359
} ) ;
500
360
501
361
describe ( 'Node.js resource: Socket' , ( ) => {
502
- it ( 'no sockets remain after client.close()' , async ( ) => {
503
- await runScriptAndGetProcessInfo (
504
- 'tls-file-read' ,
505
- config ,
506
- async function run ( { MongoClient, uri, log, chai, ClientEncryption, BSON } ) {
507
- const kmsProviders = BSON . EJSON . parse ( process . env . CSFLE_KMS_PROVIDERS ) ;
508
- const masterKey = {
509
- region : 'us-east-1' ,
510
- key : 'arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0'
511
- } ;
512
- const provider = 'aws' ;
513
-
514
- const keyVaultClient = new MongoClient ( uri ) ;
515
- await keyVaultClient . connect ( ) ;
516
-
517
- await keyVaultClient . db ( 'keyvault' ) . collection ( 'datakeys' ) ;
518
- const clientEncryption = new ClientEncryption ( keyVaultClient , {
519
- keyVaultNamespace : 'keyvault.datakeys' ,
520
- kmsProviders
521
- } ) ;
522
-
523
- const socketIdCache = process . report
524
- . getReport ( )
525
- . libuv . filter ( r => r . type === 'tcp' )
526
- . map ( r => r . address ) ;
527
- log ( { socketIdCache } ) ;
528
-
529
- // runs KMS request
530
- const dataKey = await clientEncryption
531
- . createDataKey ( provider , { masterKey } )
532
- . catch ( e => e ) ;
533
-
534
- const newSocketsBeforeClose = process . report
535
- . getReport ( )
536
- . libuv . filter ( r => ! socketIdCache . includes ( r . address ) && r . type === 'tcp' ) ;
537
- log ( { newSocketsBeforeClose } ) ;
538
- chai . expect ( newSocketsBeforeClose ) . to . have . length . gte ( 1 ) ;
539
-
540
- await keyVaultClient . close ( ) ;
541
-
542
- const newSocketsAfterClose = process . report
543
- . getReport ( )
544
- . libuv . filter ( r => ! socketIdCache . includes ( r . address ) && r . type === 'tcp' ) ;
545
- log ( { newSocketsAfterClose } ) ;
546
- chai . expect ( newSocketsAfterClose ) . to . be . empty ;
547
- }
548
- ) ;
549
- } ) ;
362
+ it ( 'no sockets remain after client.close()' , async ( ) => { } ) ;
550
363
} ) ;
551
364
} ) ;
552
365
} ) ;
0 commit comments