Skip to content
Prev Previous commit
Next Next commit
test: fix more tests
  • Loading branch information
durran committed Aug 4, 2025
commit 890d02c5ac6b44d297d62a6b2a3e55035ace5e6c
26 changes: 0 additions & 26 deletions test/integration/node-specific/auto_connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,32 +842,6 @@ describe('When executing an operation for the first time', () => {
});
});

describe(
'when the server requires auth and ping is delayed',
{ requires: { auth: 'enabled', mongodb: '>=4.4' } },
function () {
beforeEach(async function () {
// set failpoint to delay ping
// create new util client to avoid affecting the test client
const utilClient = this.configuration.newClient();
await utilClient.db('admin').command({
configureFailPoint: 'failCommand',
mode: { times: 1 },
data: { failCommands: ['ping'], blockConnection: true, blockTimeMS: 1000 }
} as FailPoint);
await utilClient.close();
});

it('timeoutMS from the client is not used for the internal `ping`', async function () {
const start = performance.now();
const returnedClient = await client.connect();
const end = performance.now();
expect(returnedClient).to.equal(client);
expect(end - start).to.be.within(1000, 1500); // timeoutMS is 1000, did not apply.
});
}
);

describe(
'when server selection takes longer than the timeout',
{ requires: { auth: 'enabled', mongodb: '>=4.4' } },
Expand Down
6 changes: 3 additions & 3 deletions test/integration/node-specific/mongo_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,15 +615,15 @@ describe('class MongoClient', function () {
'permits operations to be run after connect is called',
{ requires: { auth: 'enabled' } },
async function () {
const pingCommandToBeStarted = once(client, 'commandStarted');
const checkoutStarted = once(client, 'connectionCheckOutStarted');
await client.connect();
const [pingOnConnect] = await pingCommandToBeStarted;
const checkout = await checkoutStarted;
expect(checkout).to.not.exist;

const findCommandToBeStarted = once(client, 'commandStarted');
await client.db('test').collection('test').findOne();
const [findCommandStarted] = await findCommandToBeStarted;

expect(pingOnConnect).to.have.property('commandName', 'ping');
expect(findCommandStarted).to.have.property('commandName', 'find');
expect(client).to.have.property('topology').that.is.instanceOf(Topology);
}
Expand Down