File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/mongodb-memory-server-core/src Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -692,8 +692,9 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
692692 await this . stop ( { doCleanup : false , force : false } ) ; // stop all servers for enabling auth
693693 log ( '_initReplSet: starting all server again with auth' ) ;
694694 await this . initAllServers ( ) ; // start all servers again with "auth" enabled
695+ await this . _waitForPrimary ( ) ; // wait for a primary to come around, because otherwise server selection may time out, this may take more than 30s
695696
696- con = await MongoClient . connect ( this . getUri ( 'admin' ) , {
697+ con = await MongoClient . connect ( this . getUri ( ) , {
697698 authSource : 'admin' ,
698699 authMechanism : 'SCRAM-SHA-256' ,
699700 auth : {
@@ -728,6 +729,7 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
728729 this . stateChange ( MongoMemoryReplSetStates . running ) ;
729730 log ( '_initReplSet: running' ) ;
730731 } finally {
732+ log ( '_initReplSet: finally closing connection' ) ;
731733 await con . close ( ) ;
732734 }
733735 }
You can’t perform that action at this time.
0 commit comments