Skip to content

Commit 9236777

Browse files
test w/ fix before cleanup
1 parent 80381bc commit 9236777

File tree

7 files changed

+29
-30
lines changed

7 files changed

+29
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('Client Side Encryption Prose Corpus Test', function () {
148148
}
149149
}
150150

151-
installNodeDNSWorkaroundHooks('beforeEach');
151+
installNodeDNSWorkaroundHooks();
152152

153153
before(function () {
154154
// 1. Create a MongoClient without encryption enabled (referred to as ``client``).

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ function deadlockTests(_metadata) {
9494
metadata.skipReason = 'TODO: NODE-3891 - fix tests broken when AUTH enabled';
9595
describe('Connection Pool Deadlock Prevention', function () {
9696
installNodeDNSWorkaroundHooks('beforeEach');
97-
9897
beforeEach(function () {
9998
try {
10099
const mongodbClientEncryption = this.configuration.mongodbClientEncryption;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
7070
'base64'
7171
);
7272

73-
installNodeDNSWorkaroundHooks('beforeEach');
73+
installNodeDNSWorkaroundHooks('before');
7474

7575
describe('Data key and double encryption', function () {
7676
// Data key and double encryption

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ describe('Client Side Encryption (Legacy)', function () {
7373
testContext
7474
);
7575

76-
installNodeDNSWorkaroundHooks('beforeEach');
77-
76+
installNodeDNSWorkaroundHooks('before');
7877
after(() => testContext.teardown());
7978
before(function () {
8079
return testContext.setup(this.configuration);
@@ -98,7 +97,7 @@ describe('Client Side Encryption (Legacy)', function () {
9897
});
9998

10099
describe('Client Side Encryption (Unified)', function () {
101-
installNodeDNSWorkaroundHooks('beforeEach');
100+
installNodeDNSWorkaroundHooks('before');
102101
runUnifiedSuite(loadSpecTests(path.join('client-side-encryption', 'tests', 'unified')), () =>
103102
isServerless ? 'Unified CSFLE tests to not run on serverless' : false
104103
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Client Side Encryption Functional', function () {
2222
const keyVaultCollName = 'datakeys';
2323
const keyVaultNamespace = `${keyVaultDbName}.${keyVaultCollName}`;
2424

25-
installNodeDNSWorkaroundHooks('beforeEach');
25+
installNodeDNSWorkaroundHooks('before');
2626

2727
it('CSFLE_KMS_PROVIDERS should be valid EJSON', function () {
2828
const CSFLE_KMS_PROVIDERS = process.env.CSFLE_KMS_PROVIDERS;

test/manual/socks5.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,12 @@ async function testConnection(connectionString, clientOptions) {
305305
let topologyType;
306306
client.on('topologyDescriptionChanged', ev => (topologyType = ev.newDescription.type));
307307

308-
await client.connect();
309-
await client.db('admin').command({ hello: 1 });
310-
await client.db('test').collection('test').findOne({});
311-
await client.close();
308+
try {
309+
await client.connect();
310+
await client.db('admin').command({ hello: 1 });
311+
await client.db('test').collection('test').findOne({});
312+
} finally {
313+
await client.close();
314+
}
312315
return topologyType;
313316
}

test/tools/runner/hooks/configuration.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,29 +182,27 @@ function installNodeDNSWorkaroundHooks(type) {
182182
process.version.startsWith('v19') ||
183183
process.version.startsWith('v20');
184184

185-
console.error('configuring hooks');
186-
187185
if (!isAffectedNodeVersion || !['before', 'beforeEach'].includes(type)) {
188186
return;
189187
}
190188

191-
if (type === 'beforeEach') {
192-
beforeEach(() => {
193-
setDefaultResultOrder('ipv4first');
194-
});
195-
afterEach(() => {
196-
setDefaultResultOrder('verbatim');
197-
});
198-
} else if (type === 'before') {
199-
console.error('hooks set');
200-
before(() => {
201-
console.error('setting dns resolution ordering');
202-
setDefaultResultOrder('ipv4first');
203-
});
204-
after(() => {
205-
setDefaultResultOrder('verbatim');
206-
});
207-
}
189+
// if (type === 'beforeEach') {
190+
beforeEach(() => {
191+
setDefaultResultOrder('ipv4first');
192+
});
193+
afterEach(() => {
194+
setDefaultResultOrder('verbatim');
195+
});
196+
// } else if (type === 'before') {
197+
// before(() => {
198+
// console.error(source, 'setting dns resolution ordering');
199+
// setDefaultResultOrder('ipv4first');
200+
// });
201+
// after(() => {
202+
// console.error(source, 'set back to verbatim');
203+
// setDefaultResultOrder('verbatim');
204+
// });
205+
// }
208206
}
209207

210208
module.exports = {

0 commit comments

Comments
 (0)