atiaomar1978-hub opened a new pull request, #25335:
URL: https://github.com/apache/camel/pull/25335

   # CAMEL-23499: Fix FTPS integration test port binding failures
   
   Fixes https://issues.apache.org/jira/browse/CAMEL-23499
   
   ## Problem
   
   Eight `FileToFtps*` integration tests were disabled in PR #23327 due to 
`BindException: Address already in use` when run under Maven/CI. The tests pass 
in the IDE but fail from Maven because of parallel execution and shared 
embedded FTPS server lifecycle.
   
   ## Root cause
   
   Three related issues in the embedded FTPS test infrastructure:
   
   1. **Stale port overwrite** — `FtpsEmbeddedService.createFtpServerFactory()` 
overwrote the listener port with the instance field `port`, which could be 
stale from a prior test method restart.
   2. **Port not reset on teardown** — `FtpEmbeddedInfraService.tearDown()` did 
not reset `port = 0`, causing restarts within the same test class to reuse a 
port that may still be in TIME_WAIT.
   3. **Shared static extension** — All `FtpsServer*TestSupport` classes used 
`static @RegisterExtension` for the embedded FTPS server. Multiple IT classes 
extending the same support class (e.g. four classes extending 
`FtpsServerExplicitSSLWithoutClientAuthTestSupport`) shared one server instance 
and collided when Maven ran them in parallel.
   
   ## Fix
   
   - Preserve the port assigned by `super.createFtpServerFactory()` in 
`FtpsEmbeddedService` and `FtpsEmbeddedInfraService` instead of overwriting it.
   - Reset `port = 0` in `FtpEmbeddedInfraService.tearDown()`.
   - Change `static` to instance-level `@RegisterExtension` in all eight 
`FtpsServer*TestSupport` classes, matching the existing pattern in 
`FtpServerTestSupport`.
   - Re-enable the eight disabled `FileToFtps*` IT tests (remove `@Disabled` 
added by PR #23327).
   
   ## Testing
   
   All eight re-enabled FTPS integration tests pass together under Maven:
   
   ```
   ./mvnw -pl components/camel-ftp verify 
-Dit.test="FileToFtpsExplicitSSLWithoutClientAuthIT,FileToFtpsExplicitSSLWithoutClientAuthAndGlobalSSLContextParametersIT,FileToFtpsExplicitSSLWithClientAuthAndSSLContextParametersIT,FileToFtpsImplicitSSLWithoutClientAuthAndSSLContextParametersIT,FileToFtpsImplicitSSLWithClientAuthIT,FileToFtpsWithCustomKeyAndTrustStorePropertiesIT,FileToFtpsWithCustomTrustStorePropertiesIT,FileToFtpsWithFtpClientConfigRefIT"
   ```
   
   _AI-generated on behalf of atiaomar1978-hub_


-- 
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