-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 sure (basic) logging is set up before each test class #22920
Conversation
static { | ||
// e.g. continuous testing has everything set up already (DELAYED_HANDLER is active) | ||
if (!InitialConfigurator.DELAYED_HANDLER.isActivated()) { | ||
new Thread(() -> ConfigProvider.getConfig()).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not pretty, but saves up to ~50ms total runtime in my not-so-small project.
test-framework/junit5/src/main/java/io/quarkus/test/junit/BasicLoggingEnabler.java
Outdated
Show resolved
Hide resolved
test-framework/junit5/src/main/java/io/quarkus/test/junit/BasicLoggingEnabler.java
Outdated
Show resolved
Hide resolved
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 50f9abd
Full information is available in the Build summary check run. Failures⚙️ JVM Tests - JDK 17 #- Failing: integration-tests/grpc-hibernate
📦 integration-tests/grpc-hibernate✖
|
Very interesting approach! I like it! I assume you have tested this extensively on your project? |
Yes. I didn't test this for days but I tested the scenarios that came to mind:
@stuartwdouglas do you want to have a look as well? Thanks! |
I haven't looked at this patch in details but as for the configuration properties:
I have no idea in which case you are here but I wanted to remind you this simple rule. |
@gsmet Can a "dummy config class" be exempt from doc generation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If these are not proper config properties that read from application.properties then IMHO we should not have config classes for them, as it will confuse people when they don't work the way you would expect. I like the current junit. names as it makes it clear that this is managed by junit rather than Quarkus. That said they should be documented somewhere. |
Yes I agree. |
The config keys for TestClassOrder are really meant for users, which is why I was asking for a release-aware way to link to sources from docs, because I didn't want to repeat myself: #21748 (comment) That config key in |
Let's get this in for CR1 to receive some feedback (or at least no negative one). I'll think about that documentation task (input welcome!). PS: I'll also go through the issues I think this might be fixing. |
FTR, I believe this resolves #7696, which has received comparatively many reactions. I added a prominent comment, asking people to try out 2.7.0.CR1 and giving feedback: I will close that issue eventually. |
Alternative, actually much simpler approach to #22821 (which had this irritating flaw: #22821 (comment)).
This makes sure that basic logging is available for all kinds of (Junit) tests, Quarkus or not, right from the start!
This not only achieves the main goal of getting log output from non-Quarkus tests (in whichever order they are executed), but it has also the nice effect that all very early log output is "instant", instead of being delayed to regular log setup. E.g. a log statement from
io.quarkus.test.junit.QuarkusTestProfile.getConfigOverrides()
appears right away and will be there even if the following log activation is removed:quarkus/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
Lines 309 to 312 in f133a1b
In fact, I think most such calls can be removed with this very early running, global JUnit callback.
I could do that in a follow-up PR which could then also include the renaming from
handleFailedStart()
toinitializeBasicLogging()
(as discussed here: #22821 (comment)).PS: If this is merged, I will also follow up with a PR making#22921RestClientConfigTest
more robust and removing that catch from some core tests (see #22821 (comment)).PPS: There is at least one issue that I believe this PR will fix. I'll look it up later.