@@ -83,23 +83,20 @@ describe('Monitoring rtt tests', function () {
8383 await promise ;
8484 } ) ;
8585
86- it (
87- 'heartbeat duration is not incorrectly reported as zero on ServerHeartbeatSucceededEvents' ,
88- {
89- metadata : {
90- requires : { topology : '!load-balanced' }
91- } ,
92- test : async function ( ) {
93- for ( const durations of Object . values ( heartbeatDurations ) ) {
94- const relevantDurations = durations . slice ( IGNORE_SIZE ) ;
95- expect ( relevantDurations ) . to . have . length . gt ( 0 ) ;
96- const averageDuration =
97- relevantDurations . reduce ( ( acc , x ) => acc + x ) / relevantDurations . length ;
98- expect ( averageDuration ) . to . be . gt ( DELAY_MS ) ;
99- }
86+ it ( 'ServerHeartbeatSucceededEvent.duration is greater than or equal to the actual rtt' , {
87+ metadata : {
88+ requires : { topology : '!load-balanced' }
89+ } ,
90+ test : async function ( ) {
91+ for ( const durations of Object . values ( heartbeatDurations ) ) {
92+ const relevantDurations = durations . slice ( IGNORE_SIZE ) ;
93+ expect ( relevantDurations ) . to . have . length . gt ( 0 ) ;
94+ const averageDuration =
95+ relevantDurations . reduce ( ( acc , x ) => acc + x ) / relevantDurations . length ;
96+ expect ( averageDuration ) . to . be . gte ( DELAY_MS ) ;
10097 }
10198 }
102- ) ;
99+ } ) ;
103100
104101 it ( 'ServerDescription.roundTripTime is not incorrectly reported as zero' , {
105102 metadata : {
@@ -114,6 +111,18 @@ describe('Monitoring rtt tests', function () {
114111 }
115112 }
116113 } ) ;
114+
115+ it ( 'ServerDescription.roundTripTime is greater than or equal to the actual rtt' , {
116+ metadata : {
117+ requires : { topology : '!load-balanced' }
118+ } ,
119+ test : async function ( ) {
120+ for ( const server of Object . keys ( heartbeatDurations ) ) {
121+ const rtt = client . topology . description . servers . get ( server ) . roundTripTime ;
122+ expect ( rtt ) . to . be . gte ( DELAY_MS ) ;
123+ }
124+ }
125+ } ) ;
117126 } ) ;
118127 } ) ;
119128 }
0 commit comments