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

Strengthen tests for @QuarkusMain #45000

Merged

Conversation

holly-cummins
Copy link
Contributor

Our test coverage for @QuarkusMain is all in the picocli-native project. Although it covers more complex scenarios relating to picocli commands, it doesn't cover the specific scenario in https://quarkus.io/guides/command-mode-reference#mocking. Since it's documented, we want it to keep working. #28997

I've slightly updated the wording in the docs, since I needed a bit of help to understand the intent of the example test, and I've added an integration test which exercises the scenario of using a test profile to adjust injected beans.

This comment has been minimized.

@holly-cummins
Copy link
Contributor Author

My initial assumption is that the ClasspathInGraalITCase failure is unrelated, since I didn't touch that test, but it could be a port conflict or some other cleanup. I'll rebase to see if that changes things.

@holly-cummins holly-cummins force-pushed the strengthen-tests-for-quarkusmain branch from 1f8572d to 80a4604 Compare December 9, 2024 10:40

This comment has been minimized.

Copy link

github-actions bot commented Dec 9, 2024

🙈 The PR is closed and the preview is expired.

This comment has been minimized.

@holly-cummins
Copy link
Contributor Author

The failure's pretty reproducible, so I assume there's some cross-talk:

 Error:  io.quarkus.it.extension.ClasspathInGraalITCase.testRuntimeInitMainResourceNoDuplicate -- Time elapsed: 0.011 s <<< ERROR!
java.lang.RuntimeException: java.lang.RuntimeException: Unable to successfully launch process '2780'. Exit code is: '0'.
	at io.quarkus.test.junit.QuarkusIntegrationTestExtension.throwBootFailureException(QuarkusIntegrationTestExtension.java:373)
	at io.quarkus.test.junit.QuarkusIntegrationTestExtension.beforeEach(QuarkusIntegrationTestExtension.java:115)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.RuntimeException: Unable to successfully launch process '2780'. Exit code is: '0'.
	at io.quarkus.test.common.LauncherUtil.ensureProcessIsAlive(LauncherUtil.java:119)
	at io.quarkus.test.common.LauncherUtil.waitForCapturedListeningData(LauncherUtil.java:82)
	at io.quarkus.test.common.DefaultNativeImageLauncher.start(DefaultNativeImageLauncher.java:110)
	at io.quarkus.test.junit.IntegrationTestUtil.startLauncher(IntegrationTestUtil.java:157)
	at io.quarkus.test.junit.QuarkusIntegrationTestExtension.doProcessStart(QuarkusIntegrationTestExtension.java:301)
	at io.quarkus.test.junit.QuarkusIntegrationTestExtension.ensureStarted(QuarkusIntegrationTestExtension.java:168)
	at io.quarkus.test.junit.QuarkusIntegrationTestExtension.beforeAll(QuarkusIntegrationTestExtension.java:128)
	... 1 more

What's awesome is that I can reproduce it locally, and I can also reproduce it locally if I revert this changeset. Not sure how to debug that one.

This comment has been minimized.

@holly-cummins
Copy link
Contributor Author

@Ladicek very kindly debugged this for me, since the problem test has always failed for me locally. He pointed out that I was mixing a @QuarkusMain and @QuarkusIntegrationTest in the same module. The @QuarkusIntegrationTest runs the Quarkus application, and since there's @QuarkusMain, that's what gets executed, and it terminates early, causing unhappiness for the @QuarkusIntegrationTest.

One solution would be to split the tests out into their own modules but I was reluctant to go super-granular with the modules, so I've applied the second fix @Ladicek suggested, which is just to take QuarkusMain off the default path by adding a qualifier.

That fixes CI, so I will squash.

I also slightly clarified the wording on the docs.

Co-Authored-By: Ladislav Thon <[email protected]>
@holly-cummins holly-cummins force-pushed the strengthen-tests-for-quarkusmain branch from cef8e65 to 6ef81f9 Compare December 10, 2024 00:00
Copy link

quarkus-bot bot commented Dec 10, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 6ef81f9.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

You can consult the Develocity build scans.

Copy link

quarkus-bot bot commented Dec 10, 2024

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 6ef81f9.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@gsmet
Copy link
Member

gsmet commented Dec 10, 2024

Thanks @holly-cummins and @Ladicek !

@gsmet gsmet merged commit d5d8a4b into quarkusio:main Dec 10, 2024
23 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Dec 10, 2024
@holly-cummins
Copy link
Contributor Author

Good news! This test is already failing!

I mean, it's bad news that it's failing, but it's good news because it's failing on my classloading-rewrite branch, which means the coverage gap was real, and a regression got caught before making it to the field.

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

Successfully merging this pull request may close these issues.

2 participants