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: refactor test-net-connect-options-allowhalfopen.js #13003

Merged
merged 1 commit into from Sep 20, 2017

Conversation

Copy link
Member

@refack refack commented May 12, 2017

Try to stabilize test/parallel/test-net-connect-options-allowhalfopen.js
Fixes: #12951

Test is stable but could use some loving.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test,net

@nodejs-github-bot nodejs-github-bot added the test label May 12, 2017
@refack
Copy link
Member Author

@refack refack commented May 12, 2017

@refack refack changed the title test: to to stabilize test test: try to stabilize test May 12, 2017
@refack
Copy link
Member Author

@refack refack commented May 12, 2017

@mscdex mscdex added the net label May 13, 2017
@@ -6,6 +6,7 @@ const net = require('net');
const server = net.createServer();
server.listen(0);
const port = server.address().port;
console.log(`server port ${port}`);
Copy link
Contributor

@mscdex mscdex May 13, 2017

Choose a reason for hiding this comment

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

This should be removed.

Copy link
Member Author

@refack refack May 13, 2017

Choose a reason for hiding this comment

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

Ack.
I just added it to try to check something.
That test is interacting with the test of this PR.

@refack
Copy link
Member Author

@refack refack commented May 13, 2017

@mscdex
Copy link
Contributor

@mscdex mscdex commented May 13, 2017

A stress test CI job is better for checking flakiness fixes.

@refack
Copy link
Member Author

@refack refack commented May 13, 2017

I need to test the interaction of two test:
test/parallel/test-net-connect-local-error.js
and
test/parallel/test-net-connect-options-allowhalfopen.js
One is connecting to the other's server...

@refack
Copy link
Member Author

@refack refack commented May 13, 2017

@refack refack changed the title test: try to stabilize test test: refactor test-net-connect-options-allowhalfopen.js May 15, 2017
@refack refack force-pushed the try-fix-test-halfopen-12951 branch from d09d2c0 to dfed152 Compare May 15, 2017
@refack
Copy link
Member Author

@refack refack commented May 16, 2017

const host = common.localhostIPv4;

function serverOnConnection(socket) {
console.error(`'connection' ${++serverConnections} emitted on server`);
Copy link
Member

@jasnell jasnell Jun 13, 2017

Choose a reason for hiding this comment

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

if the console output is not necessary for the test, please remove them :-)

Copy link
Member Author

@refack refack Jun 13, 2017

Choose a reason for hiding this comment

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

They were very usefull for debugging. Gone now.

@refack
Copy link
Member Author

@refack refack commented Jun 13, 2017

@BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Aug 26, 2017

This needs a rebase and there are a couple linter errors.

@refack refack force-pushed the try-fix-test-halfopen-12951 branch from ce5ba90 to ec67d66 Compare Sep 3, 2017
@refack
Copy link
Member Author

@refack refack commented Sep 3, 2017

@refack refack force-pushed the try-fix-test-halfopen-12951 branch from ec67d66 to e02d7b0 Compare Sep 3, 2017
@refack
Copy link
Member Author

@refack refack commented Sep 3, 2017

@BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Sep 19, 2017

@Trott
Copy link
Member

@Trott Trott commented Sep 19, 2017

I need to test the interaction of two test:
test/parallel/test-net-connect-local-error.js
and
test/parallel/test-net-connect-options-allowhalfopen.js
One is connecting to the other's server...

I may be missing something important here, but you can run a stress test on just those two tests with something like:

-j 4 --repeat 100 test/parallel/test-net-connect-local-error.js test/parallel/test-net-connect-options-allowhalfopen.js

@Trott
Copy link
Member

@Trott Trott commented Sep 19, 2017

I have to attend to something else right now but I'll try to make a point to look at this in the next 24 hours...

@Trott
Copy link
Member

@Trott Trott commented Sep 20, 2017

Any chance we can get a more detailed commit message?

@Trott
Copy link
Member

@Trott Trott commented Sep 20, 2017

Change seem good to me but might be useful to get @bnoordhuis, @indutny, @nodejs/streams to take a look.

@refack
Copy link
Member Author

@refack refack commented Sep 20, 2017

-j 4 --repeat 100 test/parallel/test-net-connect-local-error.js test/parallel/test-net-connect-options-allowhalfopen.js

Yeah I didn't think about it at the time.
It was just hard to follow so I massaged it a little bit so it would be easier to track why it failed. Turns out this test on it's own is stable.
What happened is:

  1. test/parallel/test-net-connect-local-error.js is trying to connect to something like listen(0).port + 1 so it would fail.
  2. on openBSD ephemeral ports are given sequentially.
  3. This test runs in parallel and actually binds said port.
  4. both test fail.

I think we solved this dis-harmony by moving test-net-connect-local-error.js to sequential. So what's left in this PR if just refactoring.

AFAICT this was blocked because @jasnell asked to remove the logging, but I'm -0 on that since the order of events in the test is tricky. Eventually it was the log that made me wonder where the 7th connection is coming from if the clients are only making 6 🤔

Mismatched serverOnConnection function calls. Expected 6, actual 7.
    at forAllClients (/Users/iojs/build/workspace/node-test-commit-osx/nodes/osx1010/test/parallel/test-net-connect-options-allowhalfopen.js:44:38)
...
No. 4 connection is closing server:
  7 FIN received by server,
  6 FIN received by client,
  6 FIN sent by client,
  7 FIN sent by server
Server has been closed:
  7 FIN received by server,
  6 FIN received by client,
  6 FIN sent by client,
  7 FIN sent by server

Copy link
Member

@mcollina mcollina left a comment

LGTM

PR-URL: nodejs#13003
Fixes: nodejs#12951
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@refack refack force-pushed the try-fix-test-halfopen-12951 branch from e02d7b0 to 01c680b Compare Sep 20, 2017
@refack refack merged commit 01c680b into nodejs:master Sep 20, 2017
@refack
Copy link
Member Author

@refack refack commented Sep 20, 2017

@refack refack deleted the try-fix-test-halfopen-12951 branch Sep 20, 2017
jasnell pushed a commit that referenced this issue Sep 20, 2017
PR-URL: #13003
Fixes: #12951
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Qard pushed a commit to Qard/ayo that referenced this issue Sep 21, 2017
PR-URL: nodejs/node#13003
Fixes: nodejs/node#12951
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants