incubator-blur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Barton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BLUR-222) Random ports for unit tests
Date Fri, 13 Sep 2013 12:42:54 GMT

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

Garrett Barton commented on BLUR-222:
-------------------------------------

Not sure if this works totally for you, I wrote an embedded zk class that runs in its own
thread a while ago and it handles coming up on a random port. You can then ask for the port
which will block until its set (meaning zk is alive).

Check it out here:
https://github.com/gbarton/distributed_parsing/blob/master/src/main/java/com/eqt/needle/broker/EmbeddedZK.java

The important bits are this:
server = new ZooKeeperServer(logDir, logDir, tickTime);
standaloneServerFactory = ServerCnxnFactory.createFactory(0, numConnections);
standaloneServerFactory.startup(server);
int p = standaloneServerFactory.getLocalPort();
                
> 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

Mime
View raw message