Many ZooKeeper tests are flaky because they proceed with zk operation without connecting to ZooKeeper server.
Recently in our build org.apache.zookeeper.server.ZooKeeperServerMainTest.testStandalone() failed.
After analyzing we found that it is failed because it is not waiting for ZooKeeper client get connected to server. In this case normally zookeeper client gets connected immediately but if not connected immediately the test case is bound to fail.
Not only ZooKeeperServerMainTest but there are many other classes which have such test cases. This jira is to address all those test cases.