Skip to content

Commit

Permalink
Merge branch 'main' into NODE-6452-spreading
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James authored Jan 15, 2025
2 parents 953a387 + e2aa15c commit dcf5007
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
41 changes: 16 additions & 25 deletions test/integration/node-specific/resource_clean_up.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,22 @@ describe('Driver Resources', () => {
if (globalThis.AbortController == null || typeof this.configuration.serverApi === 'string') {
return;
}
try {
const res = await runScriptAndReturnHeapInfo(
'no_resource_leak_connect_close',
this.configuration,
async function run({ MongoClient, uri }) {
const mongoClient = new MongoClient(uri, { minPoolSize: 100 });
await mongoClient.connect();
// Any operations will reproduce the issue found in v5.0.0/v4.13.0
// it would seem the MessageStream has to be used?
await mongoClient.db().command({ ping: 1 });
await mongoClient.close();
}
);
startingMemoryUsed = res.startingMemoryUsed;
endingMemoryUsed = res.endingMemoryUsed;
heap = res.heap;
} catch (error) {
// We don't expect the process execution to ever fail,
// leaving helpful debugging if we see this in CI
console.log(`runScript error message: ${error.message}`);
console.log(`runScript error stack: ${error.stack}`);
console.log(`runScript error cause: ${error.cause}`);
// Fail the test
this.test?.error(error);
}
const res = await runScriptAndReturnHeapInfo(
'no_resource_leak_connect_close',
this.configuration,
async function run({ MongoClient, uri }) {
const mongoClient = new MongoClient(uri, { minPoolSize: 100 });
await mongoClient.connect();
// Any operations will reproduce the issue found in v5.0.0/v4.13.0
// it would seem the MessageStream has to be used?
await mongoClient.db().command({ ping: 1 });
await mongoClient.close();
}
);

startingMemoryUsed = res.startingMemoryUsed;
endingMemoryUsed = res.endingMemoryUsed;
heap = res.heap;
});

describe('ending memory usage', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type ProcessResourceTestFunction = (options: {

const HEAP_RESOURCE_SCRIPT_PATH = path.resolve(
__dirname,
'../../tools/fixtures/resource_script.in.js'
'../../tools/fixtures/heap_resource_script.in.js'
);
const REPORT_RESOURCE_SCRIPT_PATH = path.resolve(
__dirname,
Expand Down
2 changes: 1 addition & 1 deletion test/tools/fixtures/heap_resource_script.in.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const driverPath = DRIVER_SOURCE_PATH;
const func = FUNCTION_STRING;
const name = NAME_STRING;
const name = SCRIPT_NAME_STRING;
const uri = URI_STRING;
const iterations = ITERATIONS_STRING;

Expand Down

0 comments on commit dcf5007

Please sign in to comment.