invalid test verification in MultiTransactionTest
-------------------------------------------------
Key: ZOOKEEPER-1351
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1351
Project: ZooKeeper
Issue Type: Bug
Components: tests
Affects Versions: 3.4.0
Reporter: Patrick Hunt
Assignee: Patrick Hunt
Fix For: 3.5.0, 3.4.3
tests such as
org.apache.zookeeper.test.MultiTransactionTest.testWatchesTriggered() are
incorrect. Two issues I see
1) zk.sync is async, there is no guarantee that the watcher will be called
subsequent to sync returning
{noformat}
zk.sync("/", null, null);
assertTrue(watcher.triggered); /// incorrect assumption
{noformat}
The callback needs to be implemented, only once the callback is called can we
verify the trigger.
2) trigger is not declared as volatile, even though it will be set in the
context of a different thread (eventthread)
See
https://builds.apache.org/view/S-Z/view/ZooKeeper/job/ZooKeeper-trunk-solaris/91/testReport/junit/org.apache.zookeeper.test/MultiTransactionTest/testWatchesTriggered/
for an example of a false positive failure
{noformat}
junit.framework.AssertionFailedError
at
org.apache.zookeeper.test.MultiTransactionTest.testWatchesTriggered(MultiTransactionTest.java:236)
at
org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:52)
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira