[ https://issues.apache.org/jira/browse/HDFS-10666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15387987#comment-15387987 ]
Chris Nauroth commented on HDFS-10666: -------------------------------------- Excellent! Thank you for filing this, Mingliang. Another technique that has been helpful in the ZooKeeper tests is coordinating the JUnit thread with activities of the internal threads using a {{CountDownLatch}}. Sometimes it requires intrusive changes in the product code to make that work though. > Über-jira: Unit tests should not use fixed sleep interval to wait for > conditions > -------------------------------------------------------------------------------- > > Key: HDFS-10666 > URL: https://issues.apache.org/jira/browse/HDFS-10666 > Project: Hadoop HDFS > Issue Type: Bug > Components: test > Affects Versions: 3.0.0-alpha2 > Reporter: Mingliang Liu > Assignee: Mingliang Liu > > There have been dozens of intermittent failing unit tests because they depend > on fixed-interval sleep to wait for conditions to reach before assertion. > This umbrella jira is to replace these sleep statements with: > * {{GenericTestUtils.waitFor()}} to retry the conditions/assertions > * Trigger internal state change of {{MiniDFSCluster}}, e.g. > {{trigger\{BlockReports,HeartBeats,DeletionReports\}}} > * fails fast if specific exceptions are caught > * _ad-hoc fixes_ (TBD) > p.s. I don't know how closures in Java 8 comes into play but I'd like to see > any effort. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org