Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flaky leak test #2070

Merged
merged 3 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/client-keep-alive.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ test('keep-alive header no postfix', (t) => {
body.on('end', () => {
const timeout = setTimeout(() => {
t.fail()
}, 3e3)
}, 4e3)
client.on('disconnect', () => {
t.pass()
clearTimeout(timeout)
Expand Down
4 changes: 2 additions & 2 deletions test/connect-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ test('priotorise socket errors over timeouts', (t) => {
t.equal(err.code, 'ENOTFOUND')
})

// block for 1001ms which is enough for the dns lookup to complete and TO to fire
sleep(connectTimeout + 1)
// block for 2s which is enough for the dns lookup to complete and TO to fire
sleep(connectTimeout * 2)
})

// never connect
Expand Down
3 changes: 2 additions & 1 deletion test/fetch/fetch-leak.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test('do not leak', (t) => {
const controller = new AbortController()
fetch(url, { signal: controller.signal })
.then(res => res.arrayBuffer())
.catch(() => {})
.then(attack)
})

Expand All @@ -33,7 +34,7 @@ test('do not leak', (t) => {
const next = process.memoryUsage().heapUsed
if (next <= prev) {
t.pass()
} else if (count++ > 10) {
} else if (count++ > 20) {
t.fail()
} else {
prev = next
Expand Down