Skip to content

Commit 62144ed

Browse files
chore(NODE-6341): remove node18+ dns resolution order hooks (#4202)
1 parent 55bdeaa commit 62144ed

10 files changed

+0
-53
lines changed

test/integration/client-side-encryption/client_side_encryption.prose.06.corpus.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as path from 'path';
88
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
99
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
1010
import { type MongoClient, WriteConcern } from '../../mongodb';
11-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
1211
import { getEncryptExtraOptions } from '../../tools/utils';
1312

1413
describe('Client Side Encryption Prose Corpus Test', function () {
@@ -146,8 +145,6 @@ describe('Client Side Encryption Prose Corpus Test', function () {
146145
}
147146
}
148147

149-
installNodeDNSWorkaroundHooks();
150-
151148
let client: MongoClient;
152149

153150
beforeEach(async function () {

test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as path from 'path';
66
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
77
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
88
import { type CommandStartedEvent, MongoClient, type MongoClientOptions } from '../../mongodb';
9-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
109
import { getEncryptExtraOptions } from '../../tools/utils';
1110
import { dropCollection } from '../shared';
1211

@@ -104,8 +103,6 @@ const metadata = {
104103
}
105104
};
106105
describe('Connection Pool Deadlock Prevention', function () {
107-
installNodeDNSWorkaroundHooks();
108-
109106
beforeEach(async function () {
110107
const url: string = this.configuration.url();
111108

test/integration/client-side-encryption/client_side_encryption.prose.14.decryption_events.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
type MongoClient,
1111
MongoNetworkError
1212
} from '../../mongodb';
13-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
1413
import { getEncryptExtraOptions } from '../../tools/utils';
1514

1615
const metadata: MongoDBMetadataUI = {
@@ -27,8 +26,6 @@ const LOCAL_KEY = Buffer.from(
2726
);
2827

2928
describe('14. Decryption Events', metadata, function () {
30-
installNodeDNSWorkaroundHooks();
31-
3229
let setupClient: MongoClient;
3330
let clientEncryption;
3431
let keyId: Binary;

test/integration/client-side-encryption/client_side_encryption.prose.21.automatic_data_encryption_keys.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ClientEncryption } from '../../../src/client-side-encryption/client_enc
55
/* eslint-disable @typescript-eslint/no-restricted-imports */
66
import { MongoCryptCreateEncryptedCollectionError } from '../../../src/client-side-encryption/errors';
77
import { BSON, Collection, type Db, MongoServerError } from '../../mongodb';
8-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
98

109
const metadata: MongoDBMetadataUI = {
1110
requires: {
@@ -19,8 +18,6 @@ const documentValidationFailureCode = 121;
1918
const typeMismatchCode = 14;
2019

2120
describe('21. Automatic Data Encryption Keys', () => {
22-
installNodeDNSWorkaroundHooks();
23-
2421
let db: Db;
2522
let clientEncryption;
2623
let client;

test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { Decimal128, type Document, Double, Long, type MongoClient } from '../..
88
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
99
/* eslint-disable @typescript-eslint/no-restricted-imports */
1010
import { MongoCryptError } from '../../../src/client-side-encryption/errors';
11-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
1211

1312
const getKmsProviders = () => {
1413
const result = EJSON.parse(process.env.CSFLE_KMS_PROVIDERS || '{}') as unknown as {
@@ -135,8 +134,6 @@ const readEncryptedFieldsFile = (dataType: string): Promise<string> =>
135134
});
136135

137136
describe('Range Explicit Encryption', function () {
138-
installNodeDNSWorkaroundHooks();
139-
140137
let clientEncryption;
141138
let keyId;
142139
let keyVaultClient;

test/integration/client-side-encryption/client_side_encryption.prose.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const { EJSON } = BSON;
1010
const { LEGACY_HELLO_COMMAND, MongoCryptError } = require('../../mongodb');
1111
const { MongoServerError, MongoServerSelectionError, MongoClient } = require('../../mongodb');
1212
const { getEncryptExtraOptions } = require('../../tools/utils');
13-
const { installNodeDNSWorkaroundHooks } = require('../../tools/runner/hooks/configuration');
1413
const { coerce, gte } = require('semver');
1514

1615
const {
@@ -79,8 +78,6 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
7978
'base64'
8079
);
8180

82-
installNodeDNSWorkaroundHooks();
83-
8481
describe('Data key and double encryption', function () {
8582
// Data key and double encryption
8683
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

test/integration/client-side-encryption/client_side_encryption.spec.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as path from 'path';
22

33
import { loadSpecTests } from '../../spec';
44
import { ClientSideEncryptionFilter } from '../../tools/runner/filters/client_encryption_filter';
5-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
65
import {
76
gatherTestSuites,
87
generateTopologyTests,
@@ -70,8 +69,6 @@ describe('Client Side Encryption (Legacy)', function () {
7069
testContext
7170
);
7271

73-
installNodeDNSWorkaroundHooks();
74-
7572
after(() => testContext.teardown());
7673

7774
before(function () {
@@ -124,8 +121,6 @@ describe('Client Side Encryption (Legacy)', function () {
124121
});
125122

126123
describe('Client Side Encryption (Unified)', function () {
127-
installNodeDNSWorkaroundHooks();
128-
129124
before(async function () {
130125
await filter.initializeFilter({} as any, {});
131126
});

test/integration/client-side-encryption/driver.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as crypto from 'crypto';
66
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
77
import { type Collection, type CommandStartedEvent, type MongoClient } from '../../mongodb';
88
import * as BSON from '../../mongodb';
9-
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
109
import { getEncryptExtraOptions } from '../../tools/utils';
1110

1211
const metadata = {
@@ -23,8 +22,6 @@ describe('Client Side Encryption Functional', function () {
2322
const keyVaultCollName = 'datakeys';
2423
const keyVaultNamespace = `${keyVaultDbName}.${keyVaultCollName}`;
2524

26-
installNodeDNSWorkaroundHooks();
27-
2825
it('CSFLE_KMS_PROVIDERS should be valid EJSON', function () {
2926
const CSFLE_KMS_PROVIDERS = process.env.CSFLE_KMS_PROVIDERS;
3027
if (typeof CSFLE_KMS_PROVIDERS === 'string') {

test/manual/socks5.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { expect } from 'chai';
22
import ConnectionString from 'mongodb-connection-string-url';
33

44
import { LEGACY_HELLO_COMMAND, MongoClient, MongoParseError } from '../mongodb';
5-
import { installNodeDNSWorkaroundHooks } from '../tools/runner/hooks/configuration';
65

76
/**
87
* The SOCKS5_CONFIG environment variable is either a JSON 4-tuple
@@ -34,8 +33,6 @@ describe('Socks5 Connectivity', function () {
3433
singleConnectionString.searchParams.set('serverSelectionTimeoutMS', '2000');
3534
singleConnectionString.searchParams.set('readPreference', 'primaryPreferred');
3635

37-
installNodeDNSWorkaroundHooks();
38-
3936
context((proxyUsername ? 'with' : 'without') + ' Socks5 auth required', function () {
4037
context('with missing required Socks5 auth configuration', function () {
4138
if (!proxyUsername) {

test/tools/runner/hooks/configuration.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import { AstrolabeTestConfiguration, TestConfiguration } from '../config';
1111
import { getEnvironmentalOptions } from '../../utils';
1212
import * as mock from '../../mongodb-mock/index';
1313
import { inspect } from 'util';
14-
import { setDefaultResultOrder } from 'dns';
15-
import { coerce, gte } from 'semver';
1614

1715
import { ApiVersionFilter } from '../filters/api_version_filter';
1816
import { AuthFilter } from '../filters/auth_filter';
@@ -207,28 +205,6 @@ const beforeAllPluginImports = () => {
207205
require('mocha-sinon');
208206
};
209207

210-
/**
211-
* @remarks TODO(NODE-4884): once happy eyeballs support is added, we no longer need to set
212-
* the default dns resolution order for CI
213-
*/
214-
export function installNodeDNSWorkaroundHooks() {
215-
if (gte(coerce(process.version), coerce('18'))) {
216-
// We set before hooks because some tests connect in before hooks
217-
before(() => {
218-
setDefaultResultOrder('ipv4first');
219-
});
220-
221-
// We set beforeEach hooks to make this resilient to test ordering and
222-
// ensure each affected test has the correct ip address resolution setting
223-
beforeEach(() => {
224-
setDefaultResultOrder('ipv4first');
225-
});
226-
afterEach(() => {
227-
setDefaultResultOrder('verbatim');
228-
});
229-
}
230-
}
231-
232208
export const mochaHooks = {
233209
beforeAll: [beforeAllPluginImports, testConfigBeforeHook],
234210
beforeEach: [testSkipBeforeEachHook],

0 commit comments

Comments
 (0)