*Motivation*

The problem is zookeeper watcher notification is non-deterministic. That says 
if you create N paths in zookeeper, you might receive
x notification. x is between 1 and N. so the test is written in a very 
non-deterministic way.

```
java.lang.AssertionError: expected [1] but found [2]
        at org.testng.Assert.fail(Assert.java:96)
        at org.testng.Assert.failNotEquals(Assert.java:776)
        at org.testng.Assert.assertEqualsImpl(Assert.java:137)
        at org.testng.Assert.assertEquals(Assert.java:118)
        at org.testng.Assert.assertEquals(Assert.java:652)
        at org.testng.Assert.assertEquals(Assert.java:662)
        at 
org.apache.pulsar.zookeeper.ZookeeperCacheTest.testChildrenCacheZnodeCreatedAfterCache(ZookeeperCacheTest.java:214)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
        at 
org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:54)
        at 
org.testng.internal.InvokeMethodRunnable.run(InvokeMethodRunnable.java:44)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
```

*Changes*

rewrite the test to make it more robust.

[ Full content available at: 
https://github.com/apache/incubator-pulsar/pull/2598 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to