-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
ci: avoid using same port number for different net tests #4147
Conversation
#4107 is related to this. |
@ry How do you think? |
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.
@keroxp LGTM, with a few minor nitpicks
cli/js/tests/test_util.ts
Outdated
} | ||
const it = portIterator(); | ||
/** Obtain (maybe) safe port number for net tests */ | ||
export function usePort(): number { |
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.
Please rename to randomPort
std/http/internal/test_util.ts
Outdated
@@ -0,0 +1,20 @@ | |||
import { assert } from "../../testing/asserts.ts"; |
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.
No need to put it inside internal/
directory, please lift one level up
std/http/internal/test_util.ts
Outdated
} | ||
const it = portIterator(); | ||
/** Obtain (maybe) safe port number for net tests */ | ||
export function usePort(): number { |
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.
s/usePort/randomPort/
Are you sure this won't hide bugs? If resources are cleaned properly it should be okay to use the same port. Or maybe it can't be helped due to shutdowns not working properly on Windows, or something? |
@nayeemrmn No, thank you for pointing. I know tests around network are very unstable on windows. But what you concern about should be tested by one for that. The motivation to use random port is that there are no rules to pick port from host and sometimes it conflicts existing local services. Port number between 1000 ~ 10000 are often taken by developer. It's slightly annoying to stop other services before running Deno's test. Of course, that doesn't mean those ports are safe. |
@bartlomieju Thank you for reviewing. I've applied reviews, please check! |
const { value } = it.next(); | ||
assert(value != null); | ||
return value; | ||
} |
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 could be done more simply without an iterator and a global variable...
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.
I'm a little unsure about what consequences this will have, but it seems fine. I misunderstood the issue at first, I thought this was about the ports used for tools/http_server.py
which I think must be fixed (since they are shared across process and language boundaries).
LGTM - sorry for the delay @keroxp
This reverts commit 60cee4f.
This reverts commit 60cee4f.
* denoland/master: (35 commits) Ignore flaky test cafile_info (denoland#4517) fix(inspector): proper error message on port collision (denoland#4514) feat: Added colors to doc output (denoland#4518) v0.38.0 feat: Add "deno doc" subcommand (denoland#4500) Update to Prettier 2 and use ES Private Fields (denoland#4498) upgrade: dprint 0.9.6 (denoland#4509) upgrade: rusty_v8 to v0.3.9 (denoland#4505) feat: Support Inspector / Chrome Devtools (denoland#4484) Improve isatty and kill API docs; Deno.kill() - throw on Windows (denoland#4497) refactor: rename ConsoleOptions to InspectOptions (denoland#4493) upgrade: dprint 0.9.5 (denoland#4491) feat: window.close() (denoland#4474) errors: replace .lines with explicit .split newline (denoland#4483) doc: improve various API docs and include examples (denoland#4486) hide source line if error message longer than 150 chars (denoland#4487) fix: add fsEvent notify::Error casts (denoland#4488) feat: add queueMicrotask to d.ts (denoland#4477) Revert "avoid using same port number for test (denoland#4147)" docs: update manual about how to run tests for std (denoland#4462) ...
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Ref denoland/deno#4467 This reverts commit 60cee4f.
Some net tests (cli,std) are unstable in any platform. I doubt that one of causes is they are using same port numbers during tests. I added port picker that iterates different port number in private port range (49152 - 65535) for cli and std.
And note that when
cargo test
is running, we are using addresses below bytools/http_server.ts
:I also doubt this is the main cause of windows's too flaky CI on net tests. 🤔