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

davsclaus pushed a commit to branch tui-flaky-tests
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a1cd60a210eeefc57b5fea0316ea91dd5b48c4fc
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 2 23:05:57 2026 +0100

    chore: camel-jbang-plugin-tui - tests that use the static command line of 
the Camel CLI do not run in parallel
    
    The test classes of the module run in parallel. AiCliCommandExecutorTest 
points the
    static CamelJBangMain command line at its own main, while BorderRenderTest 
and
    ShellPanelLifecycleTest start a shell panel that takes the printer of 
whatever main
    the static points at: the command output went into the shell panel (empty 
output) or
    into its closed terminal ("Terminal has been closed", exit code 70). The 
three tests
    now share a JUnit resource lock.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/tui/AiCliCommandExecutorTest.java     | 4 ++++
 .../camel/dsl/jbang/core/commands/tui/BorderRenderTest.java       | 3 +++
 .../dsl/jbang/core/commands/tui/ShellPanelLifecycleTest.java      | 8 ++++++++
 3 files changed, 15 insertions(+)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiCliCommandExecutorTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiCliCommandExecutorTest.java
index c3d95eaee815..0337768e5394 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiCliCommandExecutorTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiCliCommandExecutorTest.java
@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
 import org.apache.camel.dsl.jbang.run.common.Printer;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
 import picocli.CommandLine;
 import picocli.CommandLine.Command;
 
@@ -135,6 +136,9 @@ class AiCliCommandExecutorTest {
     }
 
     @Test
+    // points the static command line of the Camel CLI at its own main: a 
shell panel that another test class starts
+    // meanwhile (the classes run in parallel) would take the printer of this 
main
+    @ResourceLock(ShellPanelLifecycleTest.CLI_COMMAND_LINE)
     void productionInvokerRestoresPrinterAndDoesNotQuitMain() throws Exception 
{
         // a command runs on new instances of the commands, so the test 
command is added the way plugins add theirs
         CamelJBangMain main = new CamelJBangMain() {
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/BorderRenderTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/BorderRenderTest.java
index c38bd0573d5d..67a3fec2ca54 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/BorderRenderTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/BorderRenderTest.java
@@ -25,6 +25,7 @@ import dev.tamboui.terminal.Frame;
 import dev.tamboui.widgets.block.BorderType;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -288,6 +289,8 @@ class BorderRenderTest {
     // ---- ShellPanel border test ----
 
     @Test
+    // the shell takes the printer of the static command line of the Camel CLI
+    @ResourceLock(ShellPanelLifecycleTest.CLI_COMMAND_LINE)
     void shellPanelRendersWithBorder() {
         ShellPanel panel = new ShellPanel();
         panel.setContext(ctx);
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ShellPanelLifecycleTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ShellPanelLifecycleTest.java
index 9b537e45836c..b5e3865bb0d4 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ShellPanelLifecycleTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ShellPanelLifecycleTest.java
@@ -27,6 +27,7 @@ import org.apache.camel.dsl.jbang.run.common.Printer;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.ResourceLock;
 import picocli.CommandLine;
 
 import static org.awaitility.Awaitility.await;
@@ -40,8 +41,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  * panel, and other code (AiCliCommandExecutorTest) points the static command 
line at another main in the meantime,
  * whose printer was taken and never given back, which made that test flaky.
  */
+@ResourceLock(ShellPanelLifecycleTest.CLI_COMMAND_LINE)
 class ShellPanelLifecycleTest {
 
+    /**
+     * The lock of the tests that point the static command line of the Camel 
CLI at a main of their own, or start a
+     * shell that takes it: the test classes run in parallel.
+     */
+    static final String CLI_COMMAND_LINE = "CamelJBangMain.commandLine";
+
     private Field commandLineField;
     private Object previous;
 

Reply via email to