curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Serrano (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-257) Thread.sleep in TestingZooKeeperMain.blockUntilStarted is costly for unit tests
Date Thu, 03 Sep 2015 20:35:46 GMT

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

Martin Serrano commented on CURATOR-257:
----------------------------------------

Initial results show a service discovery failure:

{noformat}
sts run: 8, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 42.701 sec <<< FAILURE!
- in org.apache.curator.x.discovery.details.TestServiceDiscovery
testNoServerOnStart(org.apache.curator.x.discovery.details.TestServiceDiscovery)  Time elapsed:
30.906 sec  <<< FAILURE!
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /test
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
	at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1590)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:214)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:203)
	at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:200)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:191)
	at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:38)
	at org.apache.curator.x.discovery.details.ServiceDiscoveryImpl.queryForNames(ServiceDiscoveryImpl.java:279)
	at org.apache.curator.x.discovery.details.TestServiceDiscovery.testNoServerOnStart(TestServiceDiscovery.java:286)
{noformat}


> Thread.sleep in TestingZooKeeperMain.blockUntilStarted is costly for unit tests
> -------------------------------------------------------------------------------
>
>                 Key: CURATOR-257
>                 URL: https://issues.apache.org/jira/browse/CURATOR-257
>             Project: Apache Curator
>          Issue Type: Improvement
>          Components: Tests
>            Reporter: Martin Serrano
>            Priority: Minor
>
> The {{TestingZooKeeperMain.blockUntilStarted()}} contains a {{Thread.sleep(1000)}} call.
 In a large battery of unit level tests (which are otherwise quick and depend on curator service
discovery) this time adds up.
> Recent communication from JZ regarding the code:
> {quote}
> As I recall, it takes some time for the server to start up and this was a hack to make
sure it’s ready.  However, I no longer remember the details. Do tests work with the timeout
removed?
> {quote}
> We are in the midst of running our battery of tests to see if removal of this sleep call
causes any issues.   Our set of tests starts and stops the testing server a few hundred times
within the same process, so I think it will show any such issues within a few runs.  If no
issues appear (and the curator tests pass of course) I will post a pull request.  
> A sleep of this sort is unreliable to ensure startup anyway.  While it may be very unlikely
for the server not to be up after 1 second, I've found with similar approaches that these
types of solutions will still fail once it a while, leading to odd and hard to reproduce test
failures.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message