File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -611,14 +611,19 @@ describe('server selection', async function () {
611
611
} ) ;
612
612
613
613
describe ( 'server selection logging feature flagging' , async function ( ) {
614
- const topologyDescription = sinon . stub ( ) ;
615
-
616
614
let mockServer ;
617
615
let topology ;
618
616
619
617
beforeEach ( async ( ) => {
620
- mockServer = await mock . createServer ( ) ;
618
+ mockServer = await mock . createServer ( 27017 , 'localhost' ) ;
621
619
topology = topologyWithPlaceholderClient ( mockServer . hostAddress ( ) , { } ) ;
620
+ // NOTE: This is done to ensure that that processWaitQueueMember doesn't throw due to an
621
+ // invalid state
622
+ topology . s . state = 'connected' ;
623
+ topology . s . servers . set ( 'localhost:27017' , mockServer ) ;
624
+ topology . s . description . servers = new Map ( [
625
+ [ mockServer . address ( ) , new ServerDescription ( 'localhost:27017' ) ]
626
+ ] ) ;
622
627
} ) ;
623
628
624
629
afterEach ( async ( ) => {
@@ -640,7 +645,9 @@ describe('server selection', async function () {
640
645
} ) ;
641
646
642
647
it ( 'should not create server selection event instances' , async function ( ) {
643
- await topology ?. selectServer ( topologyDescription , { operationName : 'test' } ) ;
648
+ await topology ?. selectServer ( ( ) => [ new ServerDescription ( 'localhost:27017' ) ] , {
649
+ operationName : 'test'
650
+ } ) ;
644
651
expect ( serverSelectionEventStub . getCall ( 0 ) ) . to . be . null ;
645
652
} ) ;
646
653
} ) ;
You can’t perform that action at this time.
0 commit comments