Skip to content

Commit 9055f9b

Browse files
committed
test: remove ping tests
1 parent 8384987 commit 9055f9b

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

packages/data-service/src/connect-mongo-client.spec.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'assert';
22
import asyncHooks from 'async_hooks';
33
import { expect } from 'chai';
4-
import type { MongoClientOptions, CommandStartedEvent } from 'mongodb';
4+
import type { MongoClientOptions } from 'mongodb';
55

66
import {
77
connectMongoClientDataService as connectMongoClient,
@@ -170,42 +170,6 @@ describe('connectMongoClient', function () {
170170
]);
171171
});
172172

173-
it('should at least try to run a ping command to verify connectivity', async function () {
174-
try {
175-
await connectMongoClient({
176-
connectionOptions: {
177-
connectionString: 'mongodb://localhost:1/?loadBalanced=true',
178-
},
179-
setupListeners,
180-
});
181-
expect.fail('missed exception');
182-
} catch (err: any) {
183-
expect(err.name).to.equal('MongoNetworkError');
184-
}
185-
});
186-
187-
it('should not run the ping command with the specified ReadPreference', async function () {
188-
const connectionString = clusterConnectionStringURL.clone();
189-
connectionString
190-
.typedSearchParams<MongoClientOptions>()
191-
.set('readPreference', 'secondaryPreferred');
192-
const commands: CommandStartedEvent[] = [];
193-
const [metadataClient, crudClient, , state] = await connectMongoClient({
194-
connectionOptions: {
195-
connectionString: connectionString.toString(),
196-
},
197-
setupListeners: (client) =>
198-
client.on('commandStarted', (ev) => commands.push(ev)),
199-
});
200-
expect(commands).to.have.lengthOf(1);
201-
expect(commands[0].commandName).to.equal('ping');
202-
expect(commands[0].command.$readPreference).to.equal(undefined);
203-
204-
for (const closeLater of [metadataClient, crudClient, state]) {
205-
toBeClosed.add(closeLater);
206-
}
207-
});
208-
209173
describe('ssh tunnel failures', function () {
210174
// Use async_hooks to track the state of the internal network server used
211175
// for SSH tunneling

0 commit comments

Comments
 (0)