This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 6bd370054f2b CAMEL-25191: Fix flaky test 
MainNotAutoConfiguredWarningTest (#27603)
6bd370054f2b is described below

commit 6bd370054f2ba236b544de170f3fbaadaaf79db0
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Oct 9 18:46:45 2026 +0200

    CAMEL-25191: Fix flaky test MainNotAutoConfiguredWarningTest (#27603)
    
    The test installs a custom WARN appender on the BaseMainSupport Log4j 
logger in
    @BeforeEach/@AfterEach, mutating global LoggerContext state. Under JUnit 
parallel
    execution, AiObservabilityConfigurationPropertiesTest concurrently emits 
WARN logs for
    unconsumed camel.aiObservability.enable properties, which leak into the 
test appender
    and cause assertion failures (17% rate normally, 78% with -T1C).
    
    The test is now @Isolated, as the other tests in the module that mutate 
global JVM
    state, and drops the public modifiers per JUnit 5 conventions.
    
    Co-authored-by: Claude Sonnet <[email protected]>
---
 .../apache/camel/main/MainNotAutoConfiguredWarningTest.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/core/camel-main/src/test/java/org/apache/camel/main/MainNotAutoConfiguredWarningTest.java
 
b/core/camel-main/src/test/java/org/apache/camel/main/MainNotAutoConfiguredWarningTest.java
index 8331a2d143ea..983cb469ab0a 100644
--- 
a/core/camel-main/src/test/java/org/apache/camel/main/MainNotAutoConfiguredWarningTest.java
+++ 
b/core/camel-main/src/test/java/org/apache/camel/main/MainNotAutoConfiguredWarningTest.java
@@ -30,11 +30,13 @@ import org.apache.logging.log4j.core.config.Property;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Isolated;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-public class MainNotAutoConfiguredWarningTest {
+@Isolated
+class MainNotAutoConfiguredWarningTest {
 
     private static final String LOGGER = BaseMainSupport.class.getName();
 
@@ -42,7 +44,7 @@ public class MainNotAutoConfiguredWarningTest {
     private AbstractAppender appender;
 
     @BeforeEach
-    public void addAppender() {
+    void addAppender() {
         appender = new AbstractAppender("MainNotAutoConfiguredWarningTest", 
null, null, true, Property.EMPTY_ARRAY) {
             @Override
             public void append(LogEvent event) {
@@ -61,7 +63,7 @@ public class MainNotAutoConfiguredWarningTest {
     }
 
     @AfterEach
-    public void removeAppender() {
+    void removeAppender() {
         LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
         ctx.getConfiguration().removeLogger(LOGGER);
         ctx.updateLoggers();
@@ -73,7 +75,7 @@ public class MainNotAutoConfiguredWarningTest {
     }
 
     @Test
-    public void testTypoIsLogged() {
+    void testTypoIsLogged() {
         Main main = new Main();
         main.configure().withAutoConfigurationFailFast(false);
         main.addProperty("camel.rest.contxtPath", "/api");
@@ -92,7 +94,7 @@ public class MainNotAutoConfiguredWarningTest {
     }
 
     @Test
-    public void testNoWarningsForValidConfiguration() {
+    void testNoWarningsForValidConfiguration() {
         Main main = new Main();
         main.configure().withAutoConfigurationFailFast(false);
         main.addProperty("camel.variable.greeting", "Hello");

Reply via email to