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: improve net-immediate-finish-test #13062

Closed
wants to merge 5 commits into from
Closed

Conversation

refack
Copy link
Contributor

@refack refack commented May 16, 2017

this tests need to fail, it's more "sanitary" to run it in /sequential/
added comment why it's ok to use common.PORT

Ref: #12996
Ref: #12376
Ref: #12950
Ref: #12951
Ref: #13055
Ref: #12964

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added (inline comment in test)
  • 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 16, 2017
@refack
Copy link
Contributor Author

refack commented May 16, 2017

Continuation of #12996
/cc @arturgvieira @Trott @gibfahn @addaleax

@arturgvieira-zz
Copy link

continued.... Thanks for letting me know, I am still working on timing on these PRs, I've only been at it for a week.

@mscdex mscdex added the net Issues and PRs related to the net subsystem. label May 16, 2017
@mscdex
Copy link
Contributor

mscdex commented May 16, 2017

I don't really see the value in the code changes. Moving the test is fine however.

@refack
Copy link
Contributor Author

refack commented May 16, 2017

I don't really see the value in the code changes. Moving the test is fine however.

Just literal coding, trying to convey the rational.
Actually I'll also add a comment.

@Trott
Copy link
Member

Trott commented May 16, 2017

Why the move to sequential?

It never actually tries to make a connection to the port or use it in any way.

The hostname lookup fails first and that throws an error, by design.

I'm not sure what is meant by "sanitary" here unless the idea is that should *** somehow get mapped to localhost, then it will could cause problems with other tests? I don't think that's worth worrying about and could be dealt with by hardcoding the port value to some other arbitrary value. Code could even look like this:

// The port is not used but should be a valid value to avoid port-based errors.
// We want the invalid hostname to trigger an error instead.
const thisPortIsNotActuallyUsed = 6767;

@refack
Copy link
Contributor Author

refack commented May 16, 2017

@Trott it's a case of "safe than sorry"... Since the test tries to make a connection to a non existing server it reminded me of #12964. I agree that it very very highly unlikely that ***:6767 will be resolvable, but 🤷‍♂️ I donno.
It was your comment #12950 (comment) that made me rethink about even a tiny benefit (what I called hygiene) to be worth the move.

If nobody likes this I'll reduce the change to your snippet.

P.S. the placing of the client.close() gives me pause... Is it even necessary?

const assert = require('assert');
const net = require('net');

const client = net.connect({host: '***', port: common.PORT});
// since this test should fail with `ENOTFOUND` becuase of the unfindable host
Copy link
Member

Choose a reason for hiding this comment

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

Nit: in general, please capitalize the first word of comments :-)

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

@refack
Copy link
Contributor Author

refack commented Jun 13, 2017

@BridgeAR
Copy link
Member

There was no update here for a long time and to me it seems this has no high likelihood of getting merged. Closing it therefore. @refack please reopen if you would like to have another look at this.

@BridgeAR BridgeAR closed this Aug 27, 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.

8 participants