File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
test/integration/sessions Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -75,10 +75,10 @@ export function executeOperation<
75
75
T extends AbstractOperation < TResult > ,
76
76
TResult = ResultTypeFromOperation < T >
77
77
> ( client : MongoClient , operation : T , callback ?: Callback < TResult > ) : Promise < TResult > | void {
78
- return maybeCallback ( ( ) => εχεςμτεθρεπατιοη ( client , operation ) , callback ) ;
78
+ return maybeCallback ( ( ) => executeOperationAsync ( client , operation ) , callback ) ;
79
79
}
80
80
81
- const assertTopology = async ( client : MongoClient ) => {
81
+ async function assertTopology ( client : MongoClient ) {
82
82
const { topology } = client ;
83
83
if ( topology == null ) {
84
84
if ( client . s . hasBeenClosed ) {
@@ -92,9 +92,9 @@ const assertTopology = async (client: MongoClient) => {
92
92
throw new MongoNotConnectedError ( 'Client must be connected before running operations' ) ;
93
93
}
94
94
return client . topology ;
95
- } ;
95
+ }
96
96
97
- async function εχεςμτεθρεπατιοη <
97
+ async function executeOperationAsync <
98
98
T extends AbstractOperation < TResult > ,
99
99
TResult = ResultTypeFromOperation < T >
100
100
> ( client : MongoClient , operation : T ) : Promise < TResult > {
Original file line number Diff line number Diff line change @@ -386,6 +386,13 @@ describe('Sessions Spec', function () {
386
386
let testCollection ;
387
387
388
388
beforeEach ( async function ( ) {
389
+ if ( this . configuration . isServerless ) {
390
+ if ( this . currentTest ) {
391
+ this . currentTest . skipReason =
392
+ 'Serverless actually tests parallel connect which is broken' ;
393
+ }
394
+ return this . skip ( ) ;
395
+ }
389
396
utilClient = await this . configuration
390
397
. newClient ( { maxPoolSize : 1 , monitorCommands : true } )
391
398
. connect ( ) ;
@@ -397,14 +404,17 @@ describe('Sessions Spec', function () {
397
404
// Fresh unused client for the test
398
405
client = await this . configuration . newClient ( { maxPoolSize : 1 , monitorCommands : true } ) ;
399
406
testCollection = client . db ( 'test' ) . collection ( 'too.many.sessions' ) ;
407
+
408
+ utilClient . name = 'ann' ;
409
+ client . name = 'bob' ;
400
410
} ) ;
401
411
402
412
afterEach ( async ( ) => {
403
413
await client ?. close ( ) ;
404
414
await utilClient ?. close ( ) ;
405
415
} ) ;
406
416
407
- it ( 'should only use one session for many operations when maxPoolSize is 1' , async ( ) => {
417
+ it ( 'should only use two sessions for many operations when maxPoolSize is 1' , async ( ) => {
408
418
const documents = Array . from ( { length : 50 } ) . map ( ( _ , idx ) => ( { _id : idx } ) ) ;
409
419
410
420
const events : CommandStartedEvent [ ] = [ ] ;
You can’t perform that action at this time.
0 commit comments