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

Using default nodePort in tests in unreliable because it might already be occupied on CI #677

Open
pmalek opened this issue May 19, 2023 · 1 comment

Comments

@pmalek
Copy link
Member

pmalek commented May 19, 2023

Problem statement

Using a concrete, default nodePort:

"--set", "proxy.http.nodePort=30080",
proves to be unreliable in tests, especially in CI since we don't have full control over the environment and sometimes the port can be already occupied e.g. https://github.com/Kong/kubernetes-testing-framework/actions/runs/5022546754/jobs/9006138317#step:8:144 which fails the test.

Proposed solution

Use something like github.com/phayes/freeport which allows finding a free port and use that in tests.

@programmer04
Copy link
Member

The external library is not even needed for such a simple thing. Passing 0 as the port number instructs the kernel to give some random free port. It will work in this case too, btw. it's what the proposed library does under the hood (but the library ensures only that this port is free for the localhost address, which may be or not a problem). I suggest copying and adjusting a helper function for our use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants