Ilya Maykov created ZOOKEEPER-3219:
--------------------------------------
Summary: Fix flaky FileChangeWatcherTest
Key: ZOOKEEPER-3219
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3219
Project: ZooKeeper
Issue Type: Improvement
Affects Versions: 3.6.0, 3.5.5
Reporter: Ilya Maykov
Assignee: Ilya Maykov
A test I committed recently is flaky. Here is an example of failed test output
from jenkins:
{code:java}
2018-12-17 21:52:53,824 [myid:] - INFO
[main:JUnit4ZKTestRunner$LoggedInvokeMethod@77] - RUNNING TEST METHOD
testCallbackErrorDoesNotCrashWatcherThread 2018-12-17 21:52:53,826 [myid:] -
INFO [FileChangeWatcher:FileChangeWatcher$WatcherThread@193] -
FileChangeWatcher thread started 2018-12-17 21:52:54,830 [myid:] - INFO
[main:FileChangeWatcherTest@237] - Modifying file 2018-12-17 21:52:54,834
[myid:] - INFO [FileChangeWatcher:FileChangeWatcherTest@222] - Got an update:
ENTRY_CREATE zk_test_5141143184635472109 2018-12-17 21:52:54,835 [myid:] -
ERROR [FileChangeWatcher:FileChangeWatcher$WatcherThread@238] - Error from
callback java.lang.RuntimeException: This error should not crash the watcher
thread at
org.apache.zookeeper.common.FileChangeWatcherTest.lambda$testCallbackErrorDoesNotCrashWatcherThread$4(FileChangeWatcherTest.java:226)
at
org.apache.zookeeper.common.FileChangeWatcher$WatcherThread.runLoop(FileChangeWatcher.java:236)
at
org.apache.zookeeper.common.FileChangeWatcher$WatcherThread.run(FileChangeWatcher.java:205)
2018-12-17 21:52:54,837 [myid:] - INFO [main:FileChangeWatcherTest@244] -
Modifying file again 2018-12-17 21:52:54,837 [myid:] - INFO
[FileChangeWatcher:FileChangeWatcherTest@222] - Got an update: ENTRY_MODIFY
zk_test_5141143184635472109 2018-12-17 21:52:54,838 [myid:] - INFO
[FileChangeWatcher:FileChangeWatcherTest@222] - Got an update: ENTRY_MODIFY
zk_test_5141143184635472109 2018-12-17 21:52:54,839 [myid:] - INFO
[FileChangeWatcher:FileChangeWatcher$WatcherThread@215] - FileChangeWatcher
thread finished 2018-12-17 21:52:54,839 [myid:] - INFO
[main:JUnit4ZKTestRunner$LoggedInvokeMethod@98] - TEST METHOD FAILED
testCallbackErrorDoesNotCrashWatcherThread java.lang.AssertionError:
expected:<2> but was:<3> at org.junit.Assert.fail(Assert.java:88) at
org.junit.Assert.failNotEquals(Assert.java:834) at
org.junit.Assert.assertEquals(Assert.java:645) at
org.junit.Assert.assertEquals(Assert.java:631) at
org.apache.zookeeper.common.FileChangeWatcherTest.testCallbackErrorDoesNotCrashWatcherThread(FileChangeWatcherTest.java:250)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:79)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:53) at
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38) at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:535)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1182)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1033)
2018-12-17 21:52:54,847 [myid:] - INFO [main:ZKTestCase$1@74] - FAILED
testCallbackErrorDoesNotCrashWatcherThread java.lang.AssertionError:
expected:<2> but was:<3> at org.junit.Assert.fail(Assert.java:88) at
org.junit.Assert.failNotEquals(Assert.java:834) at
org.junit.Assert.assertEquals(Assert.java:645) at
org.junit.Assert.assertEquals(Assert.java:631) at
org.apache.zookeeper.common.FileChangeWatcherTest.testCallbackErrorDoesNotCrashWatcherThread(FileChangeWatcherTest.java:250)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:79)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:53) at
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38) at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:535)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1182)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1033)
2018-12-17 21:52:54,848 [myid:] - INFO [main:ZKTestCase$1@64] - FINISHED
testCallbackErrorDoesNotCrashWatcherThread{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)