test: fix sequential test-net-connect-local-error#13064
test: fix sequential test-net-connect-local-error#13064sebastianplesciuc wants to merge 1 commit intonodejs:masterfrom sebastianplesciuc:fix-sequential-test-net-connect
Conversation
There was a problem hiding this comment.
Nit: fix assertion fail message
Trott
left a comment
There was a problem hiding this comment.
LGTM with nit (about the assert message--either fix it or simply remove it) addressed and green CI.
|
Stress whole |
|
Still flaky (1 out of 100 runs of the whole |
|
Could it be because of this? |
Good catch, that's probably it... As I see it we have several options:
|
|
About no. 2, wouldn't |
I don't think so because here we don't actually bind the port. |
|
What if we use some IANA reserved ports? How much of a guarantee could we have that those ports won't be used by anything else? Could we define some port constants that indicate "hey, we should never directly bind to this port in any test ever"? |
That was my thought when we started with #12964, also a valid solution. |
|
Flying a test balloon: |
|
So stress test on /cc @nodejs/testing |
|
I'm confused. If the unexpected error we're receiving is |
The expected error is That is why we need a destination port that will never be bound and will always cause |
|
Is there any chance at all that the solution is to call |
I'll try |
|
Cross-ref: #13033 |
significant change from original approved approach, not sure how I feel about it yet...more in a subsequent comment
|
Not sure how I feel about this. I suspect /cc @nodejs/testing for other opinions... |
|
Maybe I'm missing something but, considering that the purpose of this test is checking that the properties of the error object are properly set, why not consider For the record, I consider |
|
|
||
| client.on('error', common.mustCall(function onError(err) { | ||
| assert.strictEqual(err.syscall, 'connect'); | ||
| assert.strictEqual(err.code, 'ECONNREFUSED'); |
There was a problem hiding this comment.
@sebastianplesciuc IMHO @santigimeno it right, we should just add an if for EADDRINUSE (or err.code in ['ECONNREFUSED', 'EADDRINUSE'])
/cc @Trott @cjihrig
| assert.strictEqual(err.localAddress, common.localhostIPv4); | ||
| assert.strictEqual( | ||
| err.message, | ||
| `connect ECONNREFUSED ${err.address}:${err.port} ` + |
There was a problem hiding this comment.
If we decide to accept EADDRINUSE this'll need to be adjusted too
Ohh, definatly a code smell 👃...
That's sounds reasonable. Also in the near future (#13100) we'll fix |
|
@refack fixed. Let me know if it's ok. |
refack
left a comment
There was a problem hiding this comment.
LGTM, let's see a CI and another stress
|
PR CI: https://ci.nodejs.org/job/node-test-commit/10046/ |
There was a problem hiding this comment.
Are we 100% sure that ECONNREFUSED and EADDRINUSE return the same exact error message other than the err.code and that therefore this line is correct?
There was a problem hiding this comment.
AFACT they come from the same mechanism.
I tried to stress this, but didn't want to hog the freeBSD machine so only run 50 cycles.
Last time we saw 1 in a 100 give the EADDRINUSE.
So worst case we have a flake and some good comments and bread crumbs to dig further.
There was a problem hiding this comment.
Can we add a comment here explaining why EADDRINUSE is included? Otherwise, someone will come across the test in 8 months and remove EADDRINUSE and we'll be right back where we are. :-D
There was a problem hiding this comment.
I need your advice on a proper comment for this. Is this ok?
// EADDRINUSE is expected to occur on FreeBSD
// Please see https://github.com/nodejs/node/issues/13055 for more details
Not really sure if you guys approve of URLs in code comments.
There was a problem hiding this comment.
Yeah that's fine @sebastianplesciuc . Full URL is great.
There was a problem hiding this comment.
Format suggested is fine. EADDRINUSE doesn't occur every time, just sometimes, right? EADDRINUSE is expected makes it sound like it occurs every time. Maybe EADDRINUSE can occur on FreeBSD.?
There was a problem hiding this comment.
Whoops, I'm too late! :-D Anyway, the comment is fine. What I suggested is just a nit. It can be ignored.
santigimeno
left a comment
There was a problem hiding this comment.
LGTM with #13064 (comment) addressed
Fixed sequential test-net-connect-local-error by swapping port and localPort in net.connect options. Fixes: #13055
| const net = require('net'); | ||
|
|
||
| // EADDRINUSE is expected to occur on FreeBSD | ||
| // Please see https://github.com/nodejs/node/issues/13055 for more details |
There was a problem hiding this comment.
Change to:
Ref: https://github.com/nodejs/node/issues/13055
Fixed sequential test-net-connect-local-error by swapping port and localPort in net.connect options. PR-URL: nodejs#13064 Fixes: nodejs#13055 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
|
Landed in 3429c90 |
|
Post land CI: https://ci.nodejs.org/job/node-test-commit/10071/ |
Fixed sequential test-net-connect-local-error by swapping port and localPort in net.connect options.
Fixes: #13055
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test