Skip to content

Commit ab5683d

Browse files
committed
fix: leak in fle test
1 parent f7c9172 commit ab5683d

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

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

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
'use strict';
22
const BSON = require('bson');
3-
const chai = require('chai');
3+
const { expect } = require('chai');
44
const fs = require('fs');
55
const path = require('path');
6+
67
const { deadlockTests } = require('./client_side_encryption.prose.deadlock');
8+
const { dropCollection, APMEventCollector } = require('../shared');
79

8-
const expect = chai.expect;
9-
chai.use(require('chai-subset'));
10+
const { EJSON } = BSON;
1011
const { LEGACY_HELLO_COMMAND } = require('../../../src/constants');
1112

1213
const getKmsProviders = (localKey, kmipEndpoint, azureEndpoint, gcpEndpoint) => {
@@ -53,10 +54,6 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
5354
const keyVaultCollName = 'datakeys';
5455
const keyVaultNamespace = `${keyVaultDbName}.${keyVaultCollName}`;
5556

56-
const shared = require('../shared');
57-
const dropCollection = shared.dropCollection;
58-
const APMEventCollector = shared.APMEventCollector;
59-
6057
const LOCAL_KEY = Buffer.from(
6158
'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk',
6259
'base64'
@@ -337,9 +334,6 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
337334
// and confirming that the externalClient is firing off keyVault requests during
338335
// encrypted operations
339336
describe('External Key Vault Test', function () {
340-
const fs = require('fs');
341-
const path = require('path');
342-
const { EJSON } = BSON;
343337
function loadExternal(file) {
344338
return EJSON.parse(
345339
fs.readFileSync(path.resolve(__dirname, '../../spec/client-side-encryption/external', file))
@@ -541,9 +535,6 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
541535
});
542536

543537
describe('BSON size limits and batch splitting', function () {
544-
const fs = require('fs');
545-
const path = require('path');
546-
const { EJSON } = BSON;
547538
function loadLimits(file) {
548539
return EJSON.parse(
549540
fs.readFileSync(path.resolve(__dirname, '../../spec/client-side-encryption/limits', file))
@@ -621,7 +612,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
621612
}
622613
});
623614

624-
after(function () {
615+
afterEach(function () {
625616
return this.client && this.client.close();
626617
});
627618

test/tools/runner/hooks/leak_checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as chalk from 'chalk';
44
import { Socket } from 'net';
55

66
import { MongoClient } from '../../../../src/mongo_client';
7-
import { ServerSession, ServerSessionPool } from '../../../../src/sessions';
7+
import { ServerSessionPool } from '../../../../src/sessions';
88

99
class LeakChecker {
1010
static originalAcquire: typeof ServerSessionPool.prototype.acquire;

0 commit comments

Comments
 (0)