Commit 380a5d5
test: fix flaky test-http-client-timeout-with-data
test-http-client-timeout-with-data has failed here and there in CI on
FreeBSD and OS X. The test has a socket timeout set to 50ms and a timer
set for 100ms. However, they are not necessarily set in the same tick of
the event loop and their ordering is therefore not guaranteed.
Instead of using a timer, this change listens for an event on the
listener to know when the socket timeout has occurred and then runs the
code originally in the timer.
Additional refactoring: Replaced `process.on('exit', ...)` checks with
`common.mustCall()` and replaced usage of `assert.equal()` with
`assert.strictEqual()`.
PR-URL: #10431
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 14e07c9 commit 380a5d5
1 file changed
+11
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 8 | | |
15 | 9 | | |
16 | 10 | | |
| |||
21 | 15 | | |
22 | 16 | | |
23 | 17 | | |
24 | | - | |
| 18 | + | |
25 | 19 | | |
26 | 20 | | |
27 | 21 | | |
| |||
30 | 24 | | |
31 | 25 | | |
32 | 26 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
37 | 31 | | |
38 | | - | |
39 | | - | |
| 32 | + | |
| 33 | + | |
40 | 34 | | |
41 | | - | |
| 35 | + | |
42 | 36 | | |
43 | | - | |
44 | | - | |
| 37 | + | |
| 38 | + | |
45 | 39 | | |
46 | | - | |
| 40 | + | |
47 | 41 | | |
48 | 42 | | |
0 commit comments