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

refack
Copy link
Contributor

@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 Issues and PRs related to the tests. label May 12, 2017
@refack
Copy link
Contributor Author

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
Contributor Author

refack commented May 12, 2017

Trying to fail on freeBSD: https://ci.nodejs.org/job/node-test-commit-freebsd/9006/

@mscdex mscdex added the net Issues and PRs related to the net subsystem. 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

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
Contributor Author

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
Contributor Author

refack commented May 13, 2017

@mscdex
Copy link
Contributor

mscdex commented May 13, 2017

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

@refack
Copy link
Contributor Author

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
Contributor Author

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 22:46
@refack
Copy link
Contributor Author

refack commented May 16, 2017

const host = common.localhostIPv4;

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

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
Contributor Author

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
Contributor Author

refack commented Jun 13, 2017

@BridgeAR
Copy link
Member

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

@refack
Copy link
Contributor Author

refack commented Sep 3, 2017

ping @nodejs/testing

@refack
Copy link
Contributor Author

refack commented Sep 3, 2017

@BridgeAR
Copy link
Member

Ping @nodejs/testing @Trott

@Trott
Copy link
Member

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 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 commented Sep 20, 2017

Any chance we can get a more detailed commit message?

@Trott
Copy link
Member

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
Contributor Author

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

Choose a reason for hiding this comment

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

LGTM

@refack refack merged commit 01c680b into nodejs:master Sep 20, 2017
@refack
Copy link
Contributor Author

refack commented Sep 20, 2017

Quick sanity of master: https://ci.nodejs.org/job/node-test-commit-linuxone/8705/

@refack refack deleted the try-fix-test-halfopen-12951 branch September 20, 2017 20:44
jasnell pushed a commit that referenced this pull request Sep 20, 2017
PR-URL: #13003
Fixes: #12951
Reviewed-By: Matteo Collina <[email protected]>
Qard pushed a commit to Qard/ayo that referenced this pull request Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: flaky parallel/test-net-connect-options-allowhalfopen on macOS & freeBSD
8 participants