You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Kirk Lund (Jira)" <ji...@apache.org> on 2019/09/26 17:52:00 UTC

[jira] [Resolved] (GEODE-7165) GatewayReceiverImplTest may fail if a port in the test is in use

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

Kirk Lund resolved GEODE-7165.
------------------------------
    Fix Version/s: 1.11.0
       Resolution: Fixed

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