Skip to content

Commit 812f68d

Browse files
authored
test: only skip initial ping command if credentials provided (#2620)
This fixes a regression introduced in the ADL testing patch set, where the spec test runner always skips the first `ping` command sent by a client. The `ping` should only be skipped if credentials were provided to the client, since that's when the driver actually sends the command. NODE-2885
1 parent cf5c865 commit 812f68d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/functional/spec-runner/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,18 @@ function runTestSuiteTest(configuration, spec, context) {
285285
const client = configuration.newClient(url, clientOptions);
286286
CMAP_EVENTS.forEach(eventName => client.on(eventName, event => context.cmapEvents.push(event)));
287287
SDAM_EVENTS.forEach(eventName => client.on(eventName, event => context.sdamEvents.push(event)));
288-
let pingTracker = 0;
288+
289+
let skippedInitialPing = false;
289290
client.on('commandStarted', event => {
290291
if (IGNORED_COMMANDS.has(event.commandName)) {
291292
return;
292293
}
293294

294-
// This gets rid of the first ping command
295-
if (event.commandName === 'ping') {
296-
pingTracker++;
297-
if (pingTracker === 1) return;
295+
// If credentials were provided, then the Topology sends an initial `ping` command
296+
// that we want to skip
297+
if (event.commandName === 'ping' && client.topology.s.credentials && !skippedInitialPing) {
298+
skippedInitialPing = true;
299+
return;
298300
}
299301

300302
context.commandEvents.push(event);

0 commit comments

Comments
 (0)