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

Aaron McCurry commented on BLUR-222:
------------------------------------

Looks like on line 352 in the MiniCluster is where the ZooKeeper port is bound. 
 I'm not sure if you can ask ZooKeeper to bind to random port, if you can the 
normal way is setting it to port 0.  If that works, I'm sure how to get the new 
port so you will have to do some investigation there.  If it doesn't work I 
prepose a simple method for randomly choosing a port.

Create a Random object.
Bound the numbers it will generate to somewhere between 10000 and 65000
Generate a number
Try to bind to it
If fail try again
If succeed then close the socket and use the port for ZooKeeper

I open to other ideas, so if you have another I would love to hear it.

Aaron
                
> Random ports for unit tests
> ---------------------------
>
>                 Key: BLUR-222
>                 URL: https://issues.apache.org/jira/browse/BLUR-222
>             Project: Apache Blur
>          Issue Type: Bug
>          Components: Blur
>    Affects Versions: 0.2.0, 0.3.0
>            Reporter: Aaron McCurry
>
> There are a couple of unit tests that have hard coded ports, this is an issue 
> on CI servers that are multi-tenant.  The units should be random chosen when 
> the tests run.
> The big 2 are ZooKeeperStatusClusterTest and BlurMiniCluster.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to