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

Make behave tests to start containers with port-forward to run tests in non-Linux machines #51

Open
ricardozanini opened this issue Dec 27, 2023 · 5 comments

Comments

@ricardozanini
Copy link

Describe the solution you'd like
As youn may know, host networking driver won't work on Windows or Mac:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

Hence, behave tests requiring checks like check that page is served won't work since the client won't connect to the container.

A simple workaround we could implement is adding a --port-forwarding to the command line to make Cekit start the container in a random port by default (to avoid clashing when running in parallel).

Additional context
An implementation idea:

cekit --descriptor image.yaml test behave --port-forwarding :8080

Would forward a local random port to 8080.

cekit --descriptor image.yaml test behave --port-forwarding 9090:8080

Would forward the local 9090 port to 8080.

I can send a PR if you agree to implement this feature.

Cheers!

@rnc
Copy link
Contributor

rnc commented Feb 5, 2024

PRs are always welcome! @jmtd - you use Behave tests a lot - any comments on this please?

@jmtd
Copy link
Collaborator

jmtd commented Feb 14, 2024

I wonder if this could be a fix in https://github.com/cekit/behave-test-steps instead. Tests such as check that page is served could do a port forward in all cases, if it works on all platforms, then there'd be no need for a new cekit flag, or for the user to have any knowledge that the test suite had particular behavioural problems on different platforms.

@ricardozanini
Copy link
Author

+1, @jmtd
I also think that if we can add port-forward in all cases should be the way to go.

@jmtd
Copy link
Collaborator

jmtd commented Feb 14, 2024

Cool OK.

We (RH OpenJDK container images) don't make use of the check that page is served step yet; but we do use check that port {port} is open. From what I can tell, this should fail in the same scenarios as the page check. Can you confirm for me please whether that's the case?

@rnc rnc transferred this issue from cekit/cekit Feb 16, 2024
@ricardozanini
Copy link
Author

@jmtd Sorry for the long winter. Yes, it also fails since the container network is not available locally.

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

No branches or pull requests

3 participants