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

Instructions to build/run integration tests in Gradle against native image incorrect #24987

Closed
edeandrea opened this issue Apr 18, 2022 · 6 comments · Fixed by #25126
Closed
Labels
area/gradle Gradle kind/bug Something isn't working
Milestone

Comments

@edeandrea
Copy link
Contributor

Describe the bug

The Build a container friendly executable guide in the gradle tooling:

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true

Doesn't seem to work unless you also add the -Dquarkus.container-image.build=true flag.

For example, if I run

./gradlew clean build quarkusIntTest -Dquarkus.package.type=native -Dquarkus.native.container-build=true

it packages the native executable but then quarkusIntTest tries to execute the native image (not inside a container).

Instead, if I run

./gradlew clean build quarkusIntTest -Dquarkus.package.type=native -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true

Then the container image is built and the integration tests are run against the built image.

See the reproducer:
gradle-test.zip

I'm not sure if this is just a documentation issue (if it was I would have just fixed it) or if something in the Gradle plugin isn't working correctly.

There's also a thread on Zulip where this was discovered: https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Gradle.20quarkusIntTest.3B.20configure.20packaging

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

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

@edeandrea edeandrea added the kind/bug Something isn't working label Apr 18, 2022
@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Apr 18, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 18, 2022

/cc @glefloch, @quarkusio/devtools

@quarkus-bot
Copy link

quarkus-bot bot commented Apr 18, 2022

You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip.

This message is automatically generated by a bot.

@glefloch
Copy link
Member

glefloch commented Apr 18, 2022

Thanks for reporting this @edeandrea, I think this is the expected behavior.


./gradlew clean build quarkusIntTest -Dquarkus.package.type=native -Dquarkus.native.container-build=true

builds a native executable from inside a container, thus, no native-image installation is required.
The -Dquarkus.container-image.build=true property comes from the container-image extension and makes sure an image is built as part of the quarkusBuild task. This is a not a core property, so I'm not sure this should be part of this documentation. WDYT ?

@edeandrea
Copy link
Contributor Author

edeandrea commented Apr 18, 2022

Yeah I wasn't sure what was expected or not. We definitely need something in the running integration tests section though describing how someone would execute the integration tests against a container image containing a native image.

Simply showing

./gradlew quarkusIntTest

isn't enough in my opinion

@glefloch
Copy link
Member

I was about to edit this page of documentation https://quarkus.io/guides/container-image#building to mention that the quarkus.container-image.build=true property should be set for running integration test but it's already mentioned here: https://quarkus.io/guides/getting-started-testing#quarkus-integration-test
Should we specify it in multiple places ?

@edeandrea
Copy link
Contributor Author

edeandrea commented Apr 21, 2022

IDK I don't think it can hurt to mention it. I think where it really should be mentioned is on https://quarkus.io/guides/gradle-tooling#running-integration-tests.

Maybe https://quarkus.io/guides/gradle-tooling#running-integration-tests can just say something like

If you want to run integration tests against a built container image, in addition to running the quarkusIntTest task you also need to tell Gradle to build a container image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants