File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
packages/mongodb-memory-server-core/src/util Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -547,9 +547,8 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
547547 this . debug ( 'stdoutHandler: emitting "instancePrimary"' ) ;
548548 this . emit ( MongoInstanceEvents . instancePrimary ) ;
549549 }
550- if ( / m e m b e r [ \d \. : ] + i s n o w i n s t a t e \w + / i. test ( line ) ) {
551- // "[\d\.:]+" matches "0.0.0.0:0000" (IP:PORT)
552- const state = / m e m b e r [ \d \. : ] + i s n o w i n s t a t e ( \w + ) / i. exec ( line ) ?. [ 1 ] ?? 'UNKNOWN' ;
550+ if ( / t r a n s i t i o n t o \w + f r o m \w + / i. test ( line ) ) {
551+ const state = / t r a n s i t i o n t o ( \w + ) f r o m \w + / i. exec ( line ) ?. [ 1 ] ?? 'UNKNOWN' ;
553552 this . emit ( MongoInstanceEvents . instanceReplState , state ) ;
554553
555554 if ( state !== 'PRIMARY' ) {
Original file line number Diff line number Diff line change @@ -358,14 +358,14 @@ describe('MongodbInstance', () => {
358358 it ( 'should emit "instanceReplState" when member state is changed' , ( ) => {
359359 // actual line copied from mongod 4.0.14
360360 const line =
361- 'STDOUT: 2020-09-30T19:41:48.388+0200 I REPL [replexec-0] Member 127.0.0.1:34765 is now in state STARTUP ' ;
361+ '2021-08-27T18:44:01.4895064Z 2021-08-27T18:44:01.471+0000 I REPL [replication-1] transition to RECOVERING from STARTUP2 ' ;
362362
363363 mongod . isInstancePrimary = true ;
364364 mongod . stdoutHandler ( line ) ;
365365
366366 expect ( events . size ) . toEqual ( 2 ) ;
367367 expect ( events . get ( MongoInstanceEvents . instanceSTDOUT ) ) . toEqual ( line ) ;
368- expect ( events . get ( MongoInstanceEvents . instanceReplState ) ) . toEqual ( 'STARTUP ' ) ;
368+ expect ( events . get ( MongoInstanceEvents . instanceReplState ) ) . toEqual ( 'RECOVERING ' ) ;
369369 expect ( mongod . isInstancePrimary ) . toEqual ( false ) ;
370370 } ) ;
371371
You can’t perform that action at this time.
0 commit comments