[ 
https://issues.apache.org/jira/browse/GEODE-7165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Hanson closed GEODE-7165.
------------------------------

Transition from Resolved to Closed for Apache Geode 1.11.0 RC4 release.

> GatewayReceiverImplTest may fail if a port in the test is in use
> ----------------------------------------------------------------
>
>                 Key: GEODE-7165
>                 URL: https://issues.apache.org/jira/browse/GEODE-7165
>             Project: Geode
>          Issue Type: Bug
>          Components: tests
>            Reporter: Kirk Lund
>            Assignee: Kirk Lund
>            Priority: Major
>             Fix For: 1.11.0
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> GatewayReceiverImplTest may fail with a call stack like:
> {noformat}
> org.apache.geode.internal.cache.wan.GatewayReceiverImplTest > 
> startShouldTryAllPortsInPortRangeIfIOExceptionIsThrown FAILED
>     org.mockito.exceptions.verification.TooLittleActualInvocations:
>     internalCacheServer.start();
>     Wanted 101 times:
>     -> at 
> org.apache.geode.internal.cache.wan.GatewayReceiverImplTest.startShouldTryAllPortsInPortRangeIfIOExceptionIsThrown(GatewayReceiverImplTest.java:167)
>     But was 100 times:
>     -> at 
> org.apache.geode.internal.cache.wan.GatewayReceiverImpl.tryToStart(GatewayReceiverImpl.java:157)
>     -> at 
> org.apache.geode.internal.cache.wan.GatewayReceiverImpl.tryToStart(GatewayReceiverImpl.java:157)
>     -> at 
> org.apache.geode.internal.cache.wan.GatewayReceiverImpl.tryToStart(GatewayReceiverImpl.java:157)
>     -> at 
> org.apache.geode.internal.cache.wan.GatewayReceiverImpl.tryToStart(GatewayReceiverImpl.java:157)
>     -> at 
> org.apache.geode.internal.cache.wan.GatewayReceiverImpl.tryToStart(GatewayReceiverImpl.java:157)
> {noformat}
> The test is assuming that only the underlying CacheServer will try the ports 
> in the start-end port range. However, I just found this line of code in 
> GatewayReceiverImpl:
> {noformat}
>   private boolean tryToStart(int port) {
>     if (!AvailablePort.isPortAvailable(port, SOCKET, getAddress(SOCKET))) {
>       return false;
>     }
> {noformat}
> The above early-out will test the availability of the port and exit without 
> interacting with the mock CacheServer provided by the test. Thus, if any of 
> the ports in the range are actually in use on the machine running the test, 
> it will fail.



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

Reply via email to