Skip to content
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: fixed flaky test-http-readable-data-event #19931

Closed
wants to merge 1 commit into from

Conversation

mcollina
Copy link
Member

$ ./tools/test.py -j 96 --repeat=192 test/parallel/test-http-readable-data-event.js
[00:11|% 100|+ 192|-   0]: Done

Fixes: #19905

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Apr 11, 2018
@mcollina
Copy link
Member Author

cc @Trott @BridgeAR @MylesBorins

@mcollina
Copy link
Member Author

@mcollina
Copy link
Member Author

Flaky CI run on FreeBSD: https://ci.nodejs.org/job/node-stress-single-test/1813/

@mcollina mcollina requested a review from lpinca April 11, 2018 07:01
Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM.

@lpinca
Copy link
Member

lpinca commented Apr 11, 2018

Can you please also fix this

res.on('error', common.mustNotCall);

it should be common.mustNotCall().

@lpinca
Copy link
Member

lpinca commented Apr 11, 2018

I've stopped and restarted the stress test to add the -j 96 --repeat 192 parameters.
Stress test FreeBSD 10: https://ci.nodejs.org/job/node-stress-single-test/1814/

@mcollina mcollina force-pushed the fix-readable-flaky-test branch from e1e65cd to 4865576 Compare April 11, 2018 07:32
@mcollina
Copy link
Member Author

@lpinca it was still flaky with the -j 96 parameter.

Started it again: https://ci.nodejs.org/job/node-stress-single-test/1815/

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, even better now.

@lpinca
Copy link
Member

lpinca commented Apr 11, 2018

@@ -27,14 +32,15 @@ const server = http.createServer((req, res) => {
const expectedRead = [helloWorld, null, helloAgainLater, null];

const req = http.request(opts, (res) => {
res.on('error', common.mustNotCall);
res.on('error', common.mustNotCall());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


res.on('readable', common.mustCall(() => {
let data;

do {
data = res.read();
assert.strictEqual(data, expectedRead.shift());
next();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to remove the next and use a boolean to verify that res.end(helloAgainLater) was not yet called. That should be simpler but does the same as far as I read the code.

// Here
if (!streamEnded) {
  res.end(helloAgainLater);
  streamEnded = true;
}
// At the top of the file
let streamEnded = false;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not what the test is supposed to verify. The intent is that we need to wait for the first chunk to be received before sending the second.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next call can be moved after the loop but it's also ok as is.

@Trott
Copy link
Member

Trott commented Apr 11, 2018

@nodejs/testing @nodejs/http

@Trott
Copy link
Member

Trott commented Apr 11, 2018

These changes fix the issue on my local machine. 👍

@Trott Trott added the fast-track PRs that do not need to wait for 48 hours to land. label Apr 12, 2018
res.end(helloAgainLater);
}, common.platformTimeout(10));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus points for making an instance of platformTimeout() unnecessary.

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 12, 2018
@lpinca
Copy link
Member

lpinca commented Apr 12, 2018

The fast-track label was added, is it ok to land this now?

@mcollina
Copy link
Member Author

Landed in 5a8fcd0

@mcollina mcollina closed this Apr 12, 2018
@mcollina mcollina deleted the fix-readable-flaky-test branch April 12, 2018 07:55
mcollina added a commit that referenced this pull request Apr 12, 2018
Fixes: #19905

PR-URL: #19931
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 16, 2018
Fixes: #19905

PR-URL: #19931
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. fast-track PRs that do not need to wait for 48 hours to land. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants