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

@QuarkusMainIntegrationTest not implemented for Docker #38368

Closed
constantin-ungureanu-github opened this issue Jan 24, 2024 · 6 comments · Fixed by #45901
Closed

@QuarkusMainIntegrationTest not implemented for Docker #38368

constantin-ungureanu-github opened this issue Jan 24, 2024 · 6 comments · Fixed by #45901
Labels
area/testing kind/bug Something isn't working
Milestone

Comments

@constantin-ungureanu-github
Copy link

constantin-ungureanu-github commented Jan 24, 2024

Describe the bug

I am building native images and package those as container image:
mvn clean install -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true

I have a Command Mode Application, with a container that should be short lived, so thus I want to have it native, to boot fast.
Testing with @QuarkusMainis fine but @QuarkusMainIntegrationTest is not implemented. This is for some time, I was expecting at some point it will be implemented, but still not, thus this issue (maybe you forgot to implement this).

I do need to use Docker for integration testing (not having rights on a Windows machine, and cannot install additional Microsoft packages needed for native build, thus building using the build docker image, and the output also as an image).

java.lang.RuntimeException: java.lang.UnsupportedOperationException: not implemented for docker yet
	at io.quarkus.test.junit.QuarkusMainIntegrationTestExtension.doProcessStart(QuarkusMainIntegrationTestExtension.java:195)
	at io.quarkus.test.junit.QuarkusMainIntegrationTestExtension.doLaunch(QuarkusMainIntegrationTestExtension.java:67)
	at io.quarkus.test.junit.QuarkusMainIntegrationTestExtension.beforeEach(QuarkusMainIntegrationTestExtension.java:55)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.UnsupportedOperationException: not implemented for docker yet
	at io.quarkus.test.common.DefaultDockerContainerLauncher.runToCompletion(DefaultDockerContainerLauncher.java:72)
	at io.quarkus.test.junit.QuarkusMainIntegrationTestExtension.doProcessStart(QuarkusMainIntegrationTestExtension.java:174)
	... 4 more

Source code of DefaultDockerContainerLauncher:

    @Override
    public LaunchResult runToCompletion(String[] args) {
        throw new UnsupportedOperationException("not implemented for docker yet");
    }

Expected behavior

@QuarkusMainIntegrationTest tests to run when the input is a Docker container.

Actual behavior

@QuarkusMainIntegrationTest not implemented for Docker.

How to Reproduce?

  1. build any example with mvn clean install -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true
  2. run any test with @QuarkusMainIntegrationTest for the container build at step 1.

Output of uname -a or ver

No response

Output of java -version

No response

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@quarkus-bot quarkus-bot bot added the env/windows Impacts Windows machines label Jan 24, 2024
Copy link

quarkus-bot bot commented Jan 24, 2024

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel)

@geoand geoand added area/testing and removed env/windows Impacts Windows machines area/native-image labels Jan 24, 2024
@galderz
Copy link
Member

galderz commented Jan 31, 2024

I have a Command Mode Application, with a container that should be short lived, so thus I want to have it native, to boot fast. Testing with @QuarkusMainis fine but @QuarkusMainIntegrationTest is not implemented. This is for some time, I was expecting at some point it will be implemented, but still not, thus this issue (maybe you forgot to implement this).

You can always try to implement it yourself and contribute it back to Quarkus. Looking at existing LaunchResult runToCompletion(String[] args) implementations and with a bit of debugging you can get a grasp of what needs doing. If you have doubts or questions with the implementation, you can email quarkus-dev group or ask in the #dev stream in Quarkus Zulip chat server.

@constantin-ungureanu-github
Copy link
Author

I'd love to add this, although I have no experience in adding new functionality in quarkus. however, time available is the problem.
this functionality of running integration tests using the containers seems like an important one, to fully qualify the container that would go in production. I recall there were some cases where native build and non-native builds had differences.

@galderz
Copy link
Member

galderz commented Mar 12, 2024

I'd love to add this, although I have no experience in adding new functionality in quarkus. however, time available is the problem.

Best place to ask on how to do this is either Quarkus Zulip chat or the quarkus-dev list. https://quarkus.io/support

@david-deck-gca
Copy link

david-deck-gca commented Jan 1, 2025

Hello.

Since my company develops both Web and Command Mode Applications, this functionality would greatly simplify our CI processes and help our developers who are all newbies with Quarkus.

So I gave it a try and ended up with a subclass of DefaultDockerContainerLauncher where runToCompletion(String[] args) is a partial Copy/Paste of start() which returns a LaunchResult created the same way as in DefaultNativeImageLauncher.runToCompletion(String[] args).

I also had to create a Custom DockerContainerLauncherProvider to get the networkId because QuarkusIntegrationTestExtension doesn't propagate it to the Launcher.

Regards,
David
quarkus-command-mode.zip

@jgardo
Copy link
Contributor

jgardo commented Jan 28, 2025

Thanks @david-deck-gca for the .zip file you attached. I've created PR #45901 partially basing on code you provided.

@quarkus-bot quarkus-bot bot added this to the 3.19 - main milestone Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants