gnodet commented on code in PR #22983:
URL: https://github.com/apache/camel/pull/22983#discussion_r3195188923


##########
test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/SftpEmbeddedInfraService.java:
##########
@@ -136,6 +137,21 @@ public void setUpServer() throws Exception {
         sshd.start();
 
         port = ((InetSocketAddress) 
sshd.getBoundAddresses().iterator().next()).getPort();
+
+        waitForServerReady();
+    }
+
+    private void waitForServerReady() {
+        long deadline = System.nanoTime() + 5_000_000_000L; // 5 seconds
+        while (System.nanoTime() < deadline) {
+            try (Socket socket = new Socket()) {
+                socket.connect(new InetSocketAddress("localhost", port), 1000);
+                return;
+            } catch (IOException e) {
+                Thread.onSpinWait();
+            }
+        }
+        LOG.warn("SFTP server may not be ready after timeout on port {}", 
port);

Review Comment:
   Good point — increased the timeout to 30 seconds and it throws `IOException` 
on failure.
   
   _Claude Code on behalf of Guillaume Nodet_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to