You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Jakob Homan (JIRA)" <ji...@apache.org> on 2010/10/05 00:27:33 UTC

[jira] Updated: (HADOOP-6987) Use JUnit Rule to optionally fail test cases that run more than 10 seconds

     [ https://issues.apache.org/jira/browse/HADOOP-6987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Homan updated HADOOP-6987:
--------------------------------

    Attachment: HADOOP-6897.patch

Patch creates a new base class, TenSecondsTimeoutPerTest, which tests can extend to 'mix in' (as much as Java allows) this behavior.  Tests extending this class will automatically be failed if their cases run more than 10 seconds, like so:
{noformat}
@Test public void willTimeOut() throws InterruptedException {
  Thread.sleep(12 * 1000);
}
{noformat}
results in
{noformat}
 Testcase: willTimeOut took 10.007 sec
   Caused an ERROR
 test timed out after 10000 milliseconds
 java.lang.Exception: test timed out after 10000 milliseconds
   at java.lang.Thread.sleep(Native Method)
   at org.apache.hadoop.util.TestStringUtils.willTimeOut(TestStringUtils.java:45)
{noformat}
Tests cases need to be in JUnit 4 style to do this, and I've converted one from Core at random, to test its functionality.  Most - though not all - all of the Core tests behave well, so this feature is intended more for HDFS and MR. 

> Use JUnit Rule to optionally fail test cases that run more than 10 seconds
> --------------------------------------------------------------------------
>
>                 Key: HADOOP-6987
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6987
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: test
>    Affects Versions: 0.21.0
>            Reporter: Jakob Homan
>            Assignee: Jakob Homan
>             Fix For: 0.22.0
>
>         Attachments: HADOOP-6897.patch
>
>
> Using JUnit Rules annotations we can fail tests cases that take longer than 10 seconds (for instance) to run.  This provides a regression check against test cases taking longer than they had previously due to unintended code changes, as well as provides a membership criteria for unit tests versus integration tests in HDFS and MR.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.