test: improve test-tls-passphrase
test-tls-passphrase is unreliable on some systems (such as my local laptop) when run in a highly parallel way because it opens more than 20 connections to a TLS server simultaneously. Run enough of those with other tests also opening lots of connections, and ECONNRESET starts to show up:
$ tools/test.py -j 96 --repeat 192 test/parallel/test-tls-passphrase.js
...
=== release test-tls-passphrase ===
Path: parallel/test-tls-passphrase
events.js:173
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:183:27)
Emitted 'error' event at:
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:84:9)
...
[00:21|% 100|+ 137|- 55]: Done
This change runs all the connections in sequence. This results in a much more reliable test:
$ tools/test.py -j 96 --repeat 192 test/parallel/test-tls-passphrase.js
[00:08|% 100|+ 192|- 0]: Done
$
Notice that the test run is also much faster this way (8 seconds instead of 21 seconds). This is true even for single test runs, at least on my machine (and I suspect on any typical setup). Current master:
$ time ./node test/parallel/test-tls-passphrase.js
real 0m0.249s
user 0m0.203s
sys 0m0.036s
$
This commit:
$ time ./node test/parallel/test-tls-passphrase.js
real 0m0.093s
user 0m0.075s
sys 0m0.014s
$
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines