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

QuarkusUnitTest should support testing startup exceptions due to runtime properties #45669

Open
Christopher-Chianelli opened this issue Jan 17, 2025 · 0 comments
Labels
area/testing kind/enhancement New feature or request

Comments

@Christopher-Chianelli
Copy link
Contributor

Description

= Quarkus Extension test failure at startup

Currently Quarkus supports testing exceptions at

  • Build time
  • After startup

However, testing exceptions during startup is unsupported.
Exceptions at startup can occur because of a runtime property
that is incompatiable with other runtime properties. For
example, having a password without a username.

If you use QuarkusUnitTest.assertException, you get
AssertionFailedError: The build was expected to fail.

If you try to test the failure without QuarkusUnitTest.assertException,
you get TestInstantiationException: Failed to create test instance
with the runtime exception as the root cause.

This makes it impossible to test startup failures due to runtime config
properties, as there is nowhere to hook the exception assertion code.

Reproducer: https://github.com/Christopher-Chianelli/issue-reproducer/tree/quarkus-unit-test-startup-exception

Implementation ideas

  • Add a new method assertStartupException to QuarkusUnitTest
  • Modify assertException in QuarkusUnitTest to also test for startup exceptions
@Christopher-Chianelli Christopher-Chianelli added the kind/enhancement New feature or request label Jan 17, 2025
Christopher-Chianelli added a commit to Christopher-Chianelli/timefold-solver that referenced this issue Jan 17, 2025
Note: it is impossible to test a startup failure due to a runtime
property in Quarkus; see quarkusio/quarkus#45669
for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants