Skip to content

Commit

Permalink
Allow execution of shell IT tests in parallel in forked VMs
Browse files Browse the repository at this point in the history
Try 100 ties to find free port for remote server during execution of IT
tests in shell to allow them to run in parallel and avoid port conflicts.
  • Loading branch information
MishaDemianenko committed Jul 7, 2017
1 parent 7038b68 commit b04cf74
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
6 changes: 0 additions & 6 deletions community/shell/pom.xml
Expand Up @@ -59,12 +59,6 @@ the relevant Commercial Agreement.

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
Expand Down
28 changes: 20 additions & 8 deletions community/shell/src/test/java/org/neo4j/shell/AbstractShellIT.java
Expand Up @@ -132,17 +132,29 @@ protected void makeServerRemotelyAvailable() throws RemoteException
{
if ( remotelyAvailableOnPort == null )
{
remotelyAvailableOnPort = findFreePort();
shellServer.makeRemotelyAvailable( remotelyAvailableOnPort, SimpleAppServer.DEFAULT_NAME );
int attempts = 0;
int port = SimpleAppServer.DEFAULT_PORT;
do
{
try
{
shellServer.makeRemotelyAvailable( port, SimpleAppServer.DEFAULT_NAME );
remotelyAvailableOnPort = port;
}
catch ( Throwable error )
{
port++;
attempts++;
if ( attempts == 100 )
{
throw new RuntimeException( "Not able to find free port more them 100 times.", error );
}
}
}
while ( remotelyAvailableOnPort == null );
}
}

private int findFreePort()
{
// TODO
return SimpleAppServer.DEFAULT_PORT;
}

protected void restartServer() throws Exception
{
shellServer.shutdown();
Expand Down

0 comments on commit b04cf74

Please sign in to comment.