[ 
https://issues.apache.org/jira/browse/GEODE-9488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17397551#comment-17397551
 ] 

ASF subversion and git services commented on GEODE-9488:
--------------------------------------------------------

Commit 81523b7800ba8a8e3c6ad57294587ace1c96ac0e in geode's branch 
refs/heads/develop from Dale Emery
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=81523b7 ]

GEODE-9488: Make CqQuery test assign port (#6741)

PROBLEM

`CqPerfDUnitTest.testFailOverMatchingCQsWithMultipleServers`:
1. Starts a server on an ephemeral port
2. Stops the server
3. Restarts the server on the same port

This test failed in CI because, between steps 2 and 3, another process
bound to the ephemeral port.

SOLUTION

Change `CqPerfDUnitTest.createServer(VM)` to assign an available port via
`AvailablePortHelper`, rather than specify an ephemeral port. The ports
assigned by `AvailablePortHelper` are outside of each OS's ephemeral
port range.

CONSIDERED

I could have changed just the one failing test to assign a port. But
because there is no good reason for tests to prefer ephemeral ports by
default, I decided to change the `createServer(VM)` to always assign a
port. This change preempts this kind of problem in other tests. If a
test has an explicit need for an ephemeral port, it can call
`createServer(VM, 0)` to get one.

> CqPerfDUnitTest test expects ephemeral port to remain available
> ---------------------------------------------------------------
>
>                 Key: GEODE-9488
>                 URL: https://issues.apache.org/jira/browse/GEODE-9488
>             Project: Geode
>          Issue Type: Test
>          Components: tests
>            Reporter: Dale Emery
>            Assignee: Dale Emery
>            Priority: Major
>              Labels: GeodeOperationAPI, pull-request-available
>
> {{CqPerfDUnitTest.testFailOverMatchingCQsWithMultipleServers}} starts a 
> server on an ephemeral port, shuts the server down, and expects to be able to 
> restart the server on the same port.
> If some other process binds to that port after the server stops and before it 
> restarts, the server will be unable to bind to the port.
> Here is an example from a PR precommit CI run: 
> http://files.apachegeode-ci.info/builds/apache-develop-pr/geode-pr-6740/test-results/distributedTest/1628140081/classes/org.apache.geode.cache.query.cq.dunit.CqQueryOptimizedExecuteDUnitTest.html#testCQAllServersLeaveAndRejoin
> In this case, it was another test's debug port (\{{dt_socket}}) that bound to 
> the port while this test's server was stopped. But even when running alone, 
> this test should not expect any port in the ephemeral port range to remain 
> available.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to