Skip to content

Commit

Permalink
test(NODE-6317): fix test assertions and naming (#4217)
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James authored and baileympearson committed Sep 5, 2024
1 parent 598e8a8 commit 09c29b3
Showing 1 changed file with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,20 @@ describe('Monitoring rtt tests', function () {
await promise;
});

it(
'heartbeat duration is not incorrectly reported as zero on ServerHeartbeatSucceededEvents',
{
metadata: {
requires: { topology: '!load-balanced' }
},
test: async function () {
for (const durations of Object.values(heartbeatDurations)) {
const relevantDurations = durations.slice(IGNORE_SIZE);
expect(relevantDurations).to.have.length.gt(0);
const averageDuration =
relevantDurations.reduce((acc, x) => acc + x) / relevantDurations.length;
expect(averageDuration).to.be.gt(DELAY_MS);
}
it('ServerHeartbeatSucceededEvent.duration is greater than or equal to the actual rtt', {
metadata: {
requires: { topology: '!load-balanced' }
},
test: async function () {
for (const durations of Object.values(heartbeatDurations)) {
const relevantDurations = durations.slice(IGNORE_SIZE);
expect(relevantDurations).to.have.length.gt(0);
const averageDuration =
relevantDurations.reduce((acc, x) => acc + x) / relevantDurations.length;
expect(averageDuration).to.be.gte(DELAY_MS);
}
}
);
});

it('ServerDescription.roundTripTime is not incorrectly reported as zero', {
metadata: {
Expand All @@ -114,6 +111,18 @@ describe('Monitoring rtt tests', function () {
}
}
});

it('ServerDescription.roundTripTime is greater than or equal to the actual rtt', {
metadata: {
requires: { topology: '!load-balanced' }
},
test: async function () {
for (const server of Object.keys(heartbeatDurations)) {
const rtt = client.topology.description.servers.get(server).roundTripTime;
expect(rtt).to.be.gte(DELAY_MS);
}
}
});
});
});
}
Expand Down

0 comments on commit 09c29b3

Please sign in to comment.