[ https://issues.apache.org/jira/browse/GEODE-8772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17352701#comment-17352701 ]
ASF subversion and git services commented on GEODE-8772: -------------------------------------------------------- Commit 168bf86ebc8e0ef9df9be06143669bfe97654ab6 in geode's branch refs/heads/develop from Dale Emery [ https://gitbox.apache.org/repos/asf?p=geode.git;h=168bf86 ] GEODE-8772: WAN upgrade test port assignment (#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. > Make tests assign necessary ports in test JVM [PERMANENT] > --------------------------------------------------------- > > Key: GEODE-8772 > URL: https://issues.apache.org/jira/browse/GEODE-8772 > Project: Geode > Issue Type: Test > Components: tests > Affects Versions: 1.14.0 > Reporter: Dale Emery > Assignee: Dale Emery > Priority: Major > Labels: GeodeOperationAPI, pull-request-available > > *Make tests assign all necessary ports.* Many distributed tests and upgrade > tests (and sometimes others) launch members with default ports, especially > for JMX (1099) and HTTP service (7070). When run in parallel outside of > docker, these tests often fail because the default port is already in use in > another test. > Except when specifically testing the product's use of the defaults, every > test should assign ports from a pool of ports known to be available. For many > tests, we can accomplish this by changing the test framework to assign > available ports. Other tests may require changes in the test code. > *Assign ports only in test JVMs, and not in child VMs.* The > {{AvailablePortHelper}} class occasionally gains new features to improve its > assignment of ports when tests run in parallel. For these improvements to > work, each test must use the latest {{AvailablePortHelper}} implementation > for all port assignments. Child VMs that run older versions of Geode may not > include the latest implementation of {{AvailablePortHelper}}. For this > reason, tests should invoke {{AvailablePortHelper}} only in the test JVM and > not in child VMs. -- This message was sent by Atlassian Jira (v8.3.4#803005)