demery-pivotal opened a new pull request #6522: URL: https://github.com/apache/geode/pull/6522
Change `WANRollingUpgradeDUnitTest` and `WANRollingUpgradeCreateSenderGatewaySenderMixedSiteOneCurrentSiteTwo` to assign ports only in the test JVM. BACKGROUND As part of my project to allow Geode tests to run in parallel outside of Docker, I am changing our build system to allocate a distinct range of ports to each test JVM, and changing `AvailablePort` and `AvailablePortHelper` to honor these allocated port ranges. This commit prepares for those changes. PROBLEM - `WANRollingUpgradeCreateSenderGatewaySenderMixedSiteOneCurrentSiteTwo` calls `startLocatorWithJmxManager()` in a child VM running a prior version of Geode. This method then calls `AvailablePortHelper` to get a JMX manager port. - `WANRollingUpgradeDUnitTest` calls `addCacheServer()` in a child VM running a prior version of Geode. This method them calls `AvailablePortHelper` to get a server port. - In each case, the old implementation of `AvailablePortHelper` in the child VM does not honor the range of ports allocated to the test. - If these tests run in parallel outside of Docker, the old implementations of `AvailablePortHelper` may assign the same port number in each test. If different tests try to bind to the same port at the same time, all but one will fail. GENERAL SOLUTION Make tests assign ports only in the test JVM. The test JVM always includes the latest implementations of `AvailablePort` and `AvailablePortHelper`, and so the tests will honor any port allocation scheme defined in the latest implementation. THIS COMMIT - Change `startLocatorWithJmxManager()` and `addCacheServer()` to be factory functions that take the relevant port as a parameter and return a `SerializableRunnable` that serializes the port and can be invoked in the child VM. - Change each test to assign the relevant port in the test JVM, call the relevant factory method to get a runnable, and execute the runnable in the child VM. In this way, all ports are assigned in the test JVM, which includes the latest implementation of `AvailablePortHelper`, which will (after my eventual enhancement) honor the port ranges allocated to the test JVM and ensure that no two tests try to bind to the same port. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org