-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
test: Fix common.PIPE
to be process unique
#14168
Conversation
} | ||
} else { | ||
exports.PIPE = `${exports.tmpDir}/test.sock`; | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is block scoping really needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the const
are only used locally and there's a single exported side-effect (exports.PIPE = ...
) IMHO it's cleaner.
Similar to the function setupFoo(); setupFoo();
approach in node_bootstap.js
Maybe even V8 will inline the const
s ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, easier to see that the consts
aren't used except in exports.PIPE
.
@@ -246,7 +246,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { | |||
|
|||
Object.defineProperty(exports, 'hasCrypto', { | |||
get: function() { | |||
return process.versions.openssl ? true : false; | |||
return Boolean(process.versions.openssl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of !!
outside of minimal code competitions.
Willing to change if anyone has a strong opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion from me. I think it used to be preferred in hot paths for performance. No idea if that's still the case. Regardless, it's totally sensible to value readable code over performant code in test/common/index.js
.
Failures: not ok 220 parallel/test-cluster-eaccess
---
duration_ms: 0.218
severity: fail
stack: |-
child listening
child exiting
PIPE should have been in use.
master exited
assert.js:48
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: 'EADDRINUSE' === undefined
at Worker.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-cluster-eaccess.js:48:12)
at Worker.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/common/index.js:515:15)
at emitTwo (events.js:130:20)
at Worker.emit (events.js:213:7)
at ChildProcess.Worker.process.on (internal/cluster/worker.js:28:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at emit (internal/child_process.js:776:12)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
... not ok 1509 sequential/test-benchmark-http
---
duration_ms: 3.632
severity: fail
stack: |-
http/bench-parser.js
http/bench-parser.js n=1 len=1: 10,362.694300518135
http/check_invalid_header_char.js
http/check_invalid_header_char.js n=1 key="\"\"": 9,291.521486643438
http/check_is_http_token.js
http/check_is_http_token.js n=1 key="\"\"": 9,632.797749778445
http/chunked.js
http/chunked.js c=1 len=1 n=1 benchmarker="test-double": 1
http/client-request-body.js
http/client-request-body.js method="write" len=1 type="asc" dur=0.1: 3,782.800838240719
http/client-request-body.js method="end" len=1 type="asc" dur=0.1: 3,753.1900606189497
http/client-request-body.js method="write" len=1 type="utf" dur=0.1: 4,350.617135040606
http/client-request-body.js method="end" len=1 type="utf" dur=0.1: 4,771.837295122962
http/client-request-body.js method="write" len=1 type="buf" dur=0.1: 4,070.584983768017
http/client-request-body.js method="end" len=1 type="buf" dur=0.1: 4,119.2370015667975
http/cluster.js
http/cluster.js c=1 len=1 type="bytes" benchmarker="test-double": 1
http/cluster.js c=1 len=1 type="buffer" benchmarker="test-double": 1
http/create-clientrequest.js
http/create-clientrequest.js n=1 len=1: 1,233.710396354139
http/end-vs-write-end.js
http/end-vs-write-end.js method="write" c=1 len=1 type="asc" benchmarker="test-double": 1
http/end-vs-write-end.js method="end" c=1 len=1 type="asc" benchmarker="test-double": 1
http/end-vs-write-end.js method="write" c=1 len=1 type="utf" benchmarker="test-double": 1
http/end-vs-write-end.js method="end" c=1 len=1 type="utf" benchmarker="test-double": 1
http/end-vs-write-end.js method="write" c=1 len=1 type="buf" benchmarker="test-double": 1
http/end-vs-write-end.js method="end" c=1 len=1 type="buf" benchmarker="test-double": 1
http/http_server_for_chunky_client.js
events.js:182
throw er; // Unhandled 'error' event
^
Error: connect ENOENT /data/iojs/node-tmp/tmp.0/node-test.47355.sock
at Object.exports._errnoException (util.js:1023:11)
at exports._exceptionWithHostPort (util.js:1046:20)
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1150:14)
assert.js:48
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: 1 === 0
at ChildProcess.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/benchmark/http/http_server_for_chunky_client.js:43:10)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:929:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:212:5)
assert.js:48
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: 1 === 0
at ChildProcess.child.on (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/sequential/test-benchmark-http.js:34:10)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:12)
... |
For the commit message, maybe:
|
cb47882
to
9c9ecac
Compare
* includes a tiny bit of refactoring in adjacent lines. * fixes 1 test and 1 benchmark that depended on PIPE being constant. PR-URL: nodejs#14168 Fixes: nodejs#14128 Reviewed-By: James M Snell <[email protected]>
9c9ecac
to
c34ae48
Compare
* includes a tiny bit of refactoring in adjacent lines. * fixes 1 test and 1 benchmark that depended on PIPE being constant. PR-URL: #14168 Fixes: #14128 Reviewed-By: James M Snell <[email protected]>
* includes a tiny bit of refactoring in adjacent lines. * fixes 1 test and 1 benchmark that depended on PIPE being constant. PR-URL: #14168 Fixes: #14128 Reviewed-By: James M Snell <[email protected]>
This does not land cleanly in LTS. Please feel free to manually backport by following the guide. Please also feel free to replace do-not-land if it is being backported |
common.PIPE
to be process uniqueFixes: #14128
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test,stream,net