|
1 | 1 | import assert from 'assert';
|
2 | 2 | import asyncHooks from 'async_hooks';
|
3 | 3 | import { expect } from 'chai';
|
4 |
| -import type { MongoClientOptions, CommandStartedEvent } from 'mongodb'; |
| 4 | +import type { MongoClientOptions } from 'mongodb'; |
5 | 5 |
|
6 | 6 | import {
|
7 | 7 | connectMongoClientDataService as connectMongoClient,
|
@@ -170,42 +170,6 @@ describe('connectMongoClient', function () {
|
170 | 170 | ]);
|
171 | 171 | });
|
172 | 172 |
|
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 |
| - |
209 | 173 | describe('ssh tunnel failures', function () {
|
210 | 174 | // Use async_hooks to track the state of the internal network server used
|
211 | 175 | // for SSH tunneling
|
|
0 commit comments