Skip to content

Commit

Permalink
less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
cirospaciari committed Apr 30, 2024
1 parent a1c6285 commit 0f39522
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/js/bun/http/body-leak-test-fixture.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/js/bun/http/serve-body-leak.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ async function calculateMemoryLeak(fn: () => Promise<void>) {
memory_examples.push(report);
}
}

// wait for the last memory usage to be stable
await Bun.sleep(100);
const end_memory = await getMemoryUsage();
if (end_memory > peak_memory) {
peak_memory = end_memory;
Expand All @@ -119,7 +121,6 @@ for (const test_info of [
testName,
async () => {
const report = await calculateMemoryLeak(fn);
console.log(report);

// peak memory is too high
expect(report.peak_memory > report.start_memory * 2).toBe(false);
Expand Down

0 comments on commit 0f39522

Please sign in to comment.