Skip to content

Commit e2aa15c

Browse files
authored
chore(NODE-6664): use correct script_name and replacement substring (#4370)
1 parent 13ca440 commit e2aa15c

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

test/integration/node-specific/resource_clean_up.test.ts

+16-25
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,22 @@ describe('Driver Resources', () => {
3737
if (globalThis.AbortController == null || typeof this.configuration.serverApi === 'string') {
3838
return;
3939
}
40-
try {
41-
const res = await runScriptAndReturnHeapInfo(
42-
'no_resource_leak_connect_close',
43-
this.configuration,
44-
async function run({ MongoClient, uri }) {
45-
const mongoClient = new MongoClient(uri, { minPoolSize: 100 });
46-
await mongoClient.connect();
47-
// Any operations will reproduce the issue found in v5.0.0/v4.13.0
48-
// it would seem the MessageStream has to be used?
49-
await mongoClient.db().command({ ping: 1 });
50-
await mongoClient.close();
51-
}
52-
);
53-
startingMemoryUsed = res.startingMemoryUsed;
54-
endingMemoryUsed = res.endingMemoryUsed;
55-
heap = res.heap;
56-
} catch (error) {
57-
// We don't expect the process execution to ever fail,
58-
// leaving helpful debugging if we see this in CI
59-
console.log(`runScript error message: ${error.message}`);
60-
console.log(`runScript error stack: ${error.stack}`);
61-
console.log(`runScript error cause: ${error.cause}`);
62-
// Fail the test
63-
this.test?.error(error);
64-
}
40+
const res = await runScriptAndReturnHeapInfo(
41+
'no_resource_leak_connect_close',
42+
this.configuration,
43+
async function run({ MongoClient, uri }) {
44+
const mongoClient = new MongoClient(uri, { minPoolSize: 100 });
45+
await mongoClient.connect();
46+
// Any operations will reproduce the issue found in v5.0.0/v4.13.0
47+
// it would seem the MessageStream has to be used?
48+
await mongoClient.db().command({ ping: 1 });
49+
await mongoClient.close();
50+
}
51+
);
52+
53+
startingMemoryUsed = res.startingMemoryUsed;
54+
endingMemoryUsed = res.endingMemoryUsed;
55+
heap = res.heap;
6556
});
6657

6758
describe('ending memory usage', () => {

test/integration/node-specific/resource_tracking_script_builder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type ProcessResourceTestFunction = (options: {
2828

2929
const HEAP_RESOURCE_SCRIPT_PATH = path.resolve(
3030
__dirname,
31-
'../../tools/fixtures/resource_script.in.js'
31+
'../../tools/fixtures/heap_resource_script.in.js'
3232
);
3333
const REPORT_RESOURCE_SCRIPT_PATH = path.resolve(
3434
__dirname,

test/tools/fixtures/heap_resource_script.in.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
const driverPath = DRIVER_SOURCE_PATH;
66
const func = FUNCTION_STRING;
7-
const name = NAME_STRING;
7+
const name = SCRIPT_NAME_STRING;
88
const uri = URI_STRING;
99
const iterations = ITERATIONS_STRING;
1010

0 commit comments

Comments
 (0)