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 ddd9c779888267b4bb6e083a71ed3bf14e7a2d0f
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 2 23:05:57 2026 +0100

    chore: camel-jbang-plugin-tui - MonitorStartupTest waits for the server to 
be bound before connecting
    
    The test polled a connect with Awaitility untilAsserted, which retries only 
on an
    AssertionError: the first connect, 100 ms after the server thread started, 
threw a
    ConnectException when the Netty bind had not completed yet (cold JVM, busy 
CI), and the
    test failed at once. It now waits for the line serveBrowserOnly prints 
after the bind,
    then connects once.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/tui/MonitorStartupTest.java      | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorStartupTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorStartupTest.java
index 0afa662b10ed..2a0dd3b3e58e 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorStartupTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorStartupTest.java
@@ -83,13 +83,15 @@ class MonitorStartupTest {
             });
             serving.start();
 
-            await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> {
-                try (Socket socket = new Socket()) {
-                    socket.connect(new InetSocketAddress("127.0.0.1", port), 
500);
-                }
-            });
+            // the line is printed once the server is bound: a connect before 
that is refused, and Awaitility does
+            // not retry on the ConnectException, so wait for the line and 
connect once
+            await().atMost(10, TimeUnit.SECONDS).until(() -> 
!printer.lines.isEmpty() || !serving.isAlive());
+            assertThat(failure.get()).isNull();
             assertThat(printer.lines).containsExactly(
                     "Camel TUI in the browser at http://127.0.0.1:"; + port + 
"/ (Ctrl+C to stop)");
+            try (Socket socket = new Socket()) {
+                socket.connect(new InetSocketAddress("127.0.0.1", port), 5000);
+            }
             assertThat(serving.isAlive()).as("waits while the server 
runs").isTrue();
 
             server.stop();

Reply via email to