CAMEL-23216: Fix flaky mina sftp tests#22983
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
All tested modules (14 modules)
|
- Add server readiness probe in SftpEmbeddedInfraService to verify the embedded SFTP server accepts connections before tests run - Increase test @timeout from 30s to 60s across all mina-sftp integration tests to accommodate SSH connection + authentication overhead when tests make multiple sequential SFTP connections Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64356c7 to
f8b0158
Compare
apupier
left a comment
There was a problem hiding this comment.
the increase of timeout doesn't sound very useful. I looked to the time spent for several of the tests and the max amount of time on Jenkins Ci for one test is 12 seconds. With most of them around 2-3 seconds. When the tests are failing it was all of them. If it was due to the timeout, we should have only the ones with teime spent close to timeout impacted.
In case, the sftpservice is not fixing the issue, it will slow down the whole build.
| Thread.onSpinWait(); | ||
| } | ||
| } | ||
| LOG.warn("SFTP server may not be ready after timeout on port {}", port); |
There was a problem hiding this comment.
Why is it a log?
Shouldn't we throw an exception? or use an assertion to prevent the test from going further?
CAMEL-23216
Summary
Several mina-sftp integration tests were flaky due to SSH connection/authentication timeouts under CI load. The root causes:
@Timeout(30)— tests making multiple sequential SFTP connections (each with 10s defaultconnectTimeout+ 10s auth timeout) could easily exceed the 30-second JUnit timeout, causing thread interruption that propagated asInterruptedIOExceptionin the SSH libraryChanges
SftpEmbeddedInfraService.setUpServer()— after starting the embedded SSHD server, verify it accepts TCP connections before returning. This eliminates cold-start race conditions.@Timeoutfrom 30s to 60s across all mina-sftp integration tests (7 test classes), aligned withMinaSftpProtocolITwhich already used 60s/120s for similar operations.Test plan