gnodet opened a new pull request, #22990:
URL: https://github.com/apache/camel/pull/22990

   [CAMEL-23431](https://issues.apache.org/jira/browse/CAMEL-23431)
   
   ## Summary
   
   Migrate AS2 test infrastructure from `AvailablePortFinder` to direct port-0 
`ServerSocket` binding to eliminate the TOCTOU (time-of-check-to-time-of-use) 
race condition that causes flaky `BindException` failures in CI.
   
   **Production code changes:**
   - Add `getLocalPort()` to `AS2ServerConnection` and 
`AS2AsyncMDNServerConnection` to expose the OS-assigned port after binding
   
   **Test changes (10 files):**
   - `AS2MessageTestBase`, `AS2MessageTest`, `AS2UnencryptedMessageTest`: API 
tests now create servers with port 0 and read back the actual port
   - `AS2AsyncMDNServerConnectionTest`: Uses port 0 directly
   - `AS2ServerManagerITBase`, `AS2ServerManagerIT`, 
`AS2ServerManagerEncryptedIT`: Component tests use port 0 in configuration, 
read back actual port via `doPostSetup()`
   - `AS2ServerSecTestBase`: Same pattern for security test base class
   
   **Not migrated yet (follow-up):**
   - 8 component tests that create their own "partner" servers require 
lifecycle restructuring (the port must be known before the Camel context 
starts). These still use `AvailablePortFinder.find()` with `@RegisterExtension`.
   
   ## Test plan
   - [x] `mvn test` in `camel-as2-api` — 94 tests pass
   - [x] `mvn test` in `camel-as2-component` — 12 tests pass
   - [ ] CI green


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