Skip to content

io_uring unit tests hard code a port to listen on, which is very naughty #14907

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

Closed
andrewrk opened this issue Mar 14, 2023 · 0 comments · Fixed by #14910
Closed

io_uring unit tests hard code a port to listen on, which is very naughty #14907

andrewrk opened this issue Mar 14, 2023 · 0 comments · Fixed by #14910
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

const address_server = try net.Address.parseIp4("127.0.0.1", 3131);

const address = try net.Address.parseIp4("127.0.0.1", 3131);

const address = try net.Address.parseIp4("127.0.0.1", 3131);

You can't just grab some arbitrary port and start using it in unit tests. That port could be used by the system causing the unit tests to fail with EADDRINUSE. Or... it could be used by the very same unit tests, in another process, which is the situation happening now, in #14647. Unit tests must bind to port 0, letting the operating system assign a port, and then use that port for testing.

I will now disable all of these tests that hard code a port number.

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. labels Mar 14, 2023
@andrewrk andrewrk added this to the 0.11.0 milestone Mar 14, 2023
andrewrk added a commit that referenced this issue Mar 14, 2023
andrewrk added a commit that referenced this issue Mar 14, 2023
andrewrk added a commit that referenced this issue Mar 15, 2023
andrewrk added a commit that referenced this issue Mar 15, 2023
truemedian pushed a commit to truemedian/zig that referenced this issue Mar 30, 2023
andrewrk pushed a commit to mllken/zig that referenced this issue Jun 17, 2023
@andrewrk andrewrk modified the milestones: 0.11.0, 0.11.1 Jul 20, 2023
andrewrk pushed a commit to mllken/zig that referenced this issue Jul 24, 2023
@andrewrk andrewrk modified the milestones: 0.11.1, 0.11.0 Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant