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

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

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

GEODE-8772: ClientServer test port assignment (#6513)

Change `ClientServerMiscDUnitTestBase`, `ClientServerMiscDUnitTest`, and
`ClientServerMiscBCDUnitTest` 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

To test compatibility, `ClientServerMiscDUnitTestBase` executes
`createServerCache()` in a child VMs running old versions of Geode. The
`createServerCache()` method assigns a server port via
`AvailablePortHelper`.  The old implementation of `AvailablePortHelper`
in the child VM does not honor the range of ports allocated to the child
VM.

If such tests run in parallel outside of Docker, the
`createServerCache()` method in each test may assign the same port. If
the servers in multiple tests attempt to bind to that port at the same
time, all but one server 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

- Add a `port` parameter to `createServerCache()`.
- Change `ClientServerMiscDUnitTestBase`, `ClientServerMiscDUnitTest`,
  and `ClientServerMiscBCDUnitTest` to assign ports only methods called
  in the test JVM.

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

Reply via email to