File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1602,7 +1602,7 @@ export class Database<
16021602 if ( startOptimeDate ) {
16031603 nodeResult . syncedTo = node . optimeDate . toString ( ) ;
16041604 }
1605- const ago = ( node . optimeDate - startOptimeDate ) / 1000 ;
1605+ const ago = ( startOptimeDate - node . optimeDate ) / 1000 ;
16061606 const hrs = Math . round ( ago / 36 ) / 100 ;
16071607 let suffix = '' ;
16081608 if ( primary ) {
Original file line number Diff line number Diff line change @@ -895,8 +895,17 @@ describe('ReplicaSet', function () {
895895 expect ( result . ismaster ) . to . be . true ;
896896 } ) ;
897897 it ( 'returns StatsResult for print secondary replication info' , async function ( ) {
898+ const coll = db . getCollection ( 'cstest' ) ;
899+ await coll . insertOne ( { i : 42 } ) ;
900+
898901 const result = await rs . printSecondaryReplicationInfo ( ) ;
899902 expect ( result . type ) . to . equal ( 'StatsResult' ) ;
903+ for ( const value of Object . values (
904+ result . value as Record < string , any >
905+ ) ) {
906+ // just check that the value is not negative
907+ expect ( value . replLag ) . to . match ( / ^ \d + s e c / ) ;
908+ }
900909 } ) ;
901910 it ( 'returns StatsResult for print replication info' , async function ( ) {
902911 const result = await rs . printReplicationInfo ( ) ;
You can’t perform that action at this time.
0 commit comments