Skip to content

Commit 97154f5

Browse files
authored
fix: flaky leak test (#2070)
* fix: flaky leak test * fixuP * fixup
1 parent 3e91915 commit 97154f5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

test/client-keep-alive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ test('keep-alive header no postfix', (t) => {
142142
body.on('end', () => {
143143
const timeout = setTimeout(() => {
144144
t.fail()
145-
}, 3e3)
145+
}, 4e3)
146146
client.on('disconnect', () => {
147147
t.pass()
148148
clearTimeout(timeout)

test/connect-timeout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ test('priotorise socket errors over timeouts', (t) => {
1616
t.equal(err.code, 'ENOTFOUND')
1717
})
1818

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

2323
// never connect

test/fetch/fetch-leak.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ test('do not leak', (t) => {
2222
const controller = new AbortController()
2323
fetch(url, { signal: controller.signal })
2424
.then(res => res.arrayBuffer())
25+
.catch(() => {})
2526
.then(attack)
2627
})
2728

@@ -33,7 +34,7 @@ test('do not leak', (t) => {
3334
const next = process.memoryUsage().heapUsed
3435
if (next <= prev) {
3536
t.pass()
36-
} else if (count++ > 10) {
37+
} else if (count++ > 20) {
3738
t.fail()
3839
} else {
3940
prev = next

0 commit comments

Comments
 (0)