-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: improve zlib tests #14455
test: improve zlib tests #14455
Conversation
2b1fb45
to
6b6140e
Compare
zlib.gunzip(data, common.expectsError({ | ||
code: 'Z_DATA_ERROR', | ||
type: Error, | ||
message: 'unknown compression method' | ||
})); |
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.
This loses the check that result
is undefined
. I'd prefer leaving the old code. I don't think common.expectsError()
adds significant value, but the check for result
is in fact significant.
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.
The changes to zlib-random-byte-pipes
introduce flakiness under load that is not there currently.
With changes in this PR: $ tools/test.py -j 96 --repeat 96 test/parallel/test-zlib-random-byte-pipes.js
=== release test-zlib-random-byte-pipes ===
Path: parallel/test-zlib-random-byte-pipes
Mismatched noop function calls. Expected exactly 4, actual 5.
at Object.exports.mustCall (/Users/trott/io.js/test/common/index.js:475:10)
at Object.<anonymous> (/Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js:153:23)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
Command: out/Release/node /Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js
=== release test-zlib-random-byte-pipes ===
Path: parallel/test-zlib-random-byte-pipes
Mismatched noop function calls. Expected exactly 4, actual 5.
at Object.exports.mustCall (/Users/trott/io.js/test/common/index.js:475:10)
at Object.<anonymous> (/Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js:153:23)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
Command: out/Release/node /Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js
[...snip...] On current master: $ tools/test.py -j 96 --repeat 96 test/parallel/test-zlib-random-byte-pipes.js
[00:11|% 100|+ 96|- 0]: Done
$ |
|
||
out.on('data', common.mustCall(function(c) { | ||
console.error('hash=%s', c); | ||
inp.on('data', common.mustCall(4)); |
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.
Empirical testing shows that there is no guarantee that this will be called 4 times. Under load at least, it may be called 5 times.
Assuming that discrepancy is valid behavior, seeing that this is all from inp.pipe(gzip).pipe(gunz).pipe(out)
and we have a check later for the data
event on out
, I think this can just be removed. Probably the same for the gunz
and gzip
checks below.
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.
Was a bit afraid of that. Looking at it, the on('data') events here look entirely unnecessary.
@Trott ... updated |
ping @Trott ... I know this needs a rebase, but when you get a moment to take another look I'd appreciate it :-) |
@nodejs/testing |
daff20c
to
a905f3b
Compare
Rebased! |
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.
LGTM, two small comments but nothing I’d consider blocking
write(c) { | ||
// Simulate the way that an fs.ReadStream returns false | ||
// on *every* write like a jerk, only to resume a | ||
// moment later. |
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.
Unrelated, but we shouldn’t keep this in the source code.
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.
heh... indeed. completely missed that!
// on *every* write like a jerk, only to resume a | ||
// moment later. | ||
this._hasher.update(c); | ||
process.nextTick(this.resume.bind(this)); |
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.
Feel free to replace these with arrow functions if you like :)
oops... wrong CI for this PR ... https://ci.nodejs.org/job/node-test-pull-request/9476/ |
Only failure is unrelated. |
PR-URL: #14455 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 4e8bc71 |
PR-URL: #14455 Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #14455 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Multiple general improvements to zlib tests
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test