Caideyipi opened a new pull request, #18817:
URL: https://github.com/apache/iotdb/pull/18817

   ## Description
   
   `OpcUaSinkTest` probes ephemeral ports with `ServerSocket(0)` and closes the 
sockets before starting the Milo servers. The quality and normal sinks allocate 
their port pairs independently, so both can receive the same TCP port, or 
another process can claim a released port before startup. The second 
`customize()` then fails with `BindException: Address already in use` and `No 
endpoints bound`.
   
   Bind the test servers directly to TCP port `0` so the OS allocates each 
listening port during bind. Use distinct configured HTTPS port values to 
distinguish independent servers in the sink's shared-server map; the current 
TCP-only transport does not bind HTTPS. The lifecycle test keeps the same key 
for both sinks, preserving the existing sharing and conflict checks. Reuse the 
quality-parameter helper and remove the port-probing helpers.
   
   ### Validation
   
   - Windows, JDK 17: `mvn clean test -pl library-pipe/opc-ua-sink 
-Dtest.port.closed=true -Ddevelocity.off=true` passed: 29 tests, 0 failures, 0 
errors, 1 existing performance-test skip.
   - Ran `mvn surefire:test -pl library-pipe/opc-ua-sink -Dtest=OpcUaSinkTest 
-Dtest.port.closed=true -Ddevelocity.off=true` 10 times: all 40 test executions 
passed, with no endpoint-binding errors.
   - Spotless and Checkstyle passed.
   
   This PR has:
   
   - [x] been self-reviewed.
   - [x] modified existing tests.
   - [x] added comments explaining the port allocation and shared-server keys.
   
   ##### Key changed/added classes
   
   `OpcUaSinkTest`
   


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