zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-3996: Fix flaky ReadOnlyModeTest.testConnectionEvents

Open kezhuw opened this issue 3 years ago • 2 comments

The same watcher was resued across different clients. It is hard to know which event will last during verification, disconnected from old client or connected from new client.

A brand new watcher solves this.

kezhuw avatar Jun 22 '22 08:06 kezhuw

Failed ci:

  • https://github.com/apache/zookeeper/runs/6982815844?check_suite_focus=true
  • https://github.com/kezhuw/zookeeper/runs/6996423868?check_suite_focus=true

kezhuw avatar Jun 22 '22 08:06 kezhuw

#1667(ZOOKEEPER-4271) proposed another approach. But it have not updated for almost one year.

kezhuw avatar Jun 22 '22 09:06 kezhuw

The old test could not last 10 runs after adding Thread.sleep(700) before watcher.waitForReadOnlyConnected(5000). The assertion message proves that "disconnected from old client" comes after "connected from new client".

After patch with watcher = new CountdownWatcher(), the test last 100 runs with no failure.

kezhuw avatar Jun 17 '23 06:06 kezhuw

Submitted and Jira resolved. Thanks @kezhuw !

anmolnar avatar Jun 19 '23 09:06 anmolnar