[ 
https://issues.apache.org/jira/browse/HADOOP-9330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13612886#comment-13612886
 ] 

Robert Joseph Evans commented on HADOOP-9330:
---------------------------------------------

The concept seems fine, but the Timeout rule and @Test(timeout=XXX) are not 
aware of each other.  This means that the effective timeout of any test is 
which ever is smaller.  I don't think that this is a real problem, just that 
the comments and the name of the member variable defaultTimout is slightly 
misleading. I also don't know if we have any tests that are intended to run for 
more than 100s.  If so they will always timeout after 100s unless they do not 
extend the HadoopBase, or we set the default to be higher.

Also, I don't know if there is anything we can do about this or not, but when 
we use both timeouts, the Timeout rule's backtrace, when it fails is close to 
useless.

{code}
testSleep(org.apache.hadoop.test.TestSomething)  Time elapsed: 1091 sec  <<< 
ERROR!
java.lang.Exception: test timed out after 1000 milliseconds
        at java.lang.Object.wait(Native Method)
        at java.lang.Thread.join(Thread.java:1194)
        at 
org.junit.internal.runners.statements.FailOnTimeout.evaluate(FailOnTimeout.java:36)
        at 
org.junit.internal.runners.statements.FailOnTimeout$1.run(FailOnTimeout.java:28)
{code}

It simply says that the code that "timed out" was a thread waiting for the 
actual test to finish running :) This is because there are actually two threads 
monitoring the test, instead of just one.

I realize that a lot of my complaints are perhaps things that need to just be 
addressed by the JUnit, I just want us to be fully aware of them as we go into 
this and document things appropriately, so we know what is happening when 
issues arise.
                
> Add custom JUnit4 test runner with configurable timeout
> -------------------------------------------------------
>
>                 Key: HADOOP-9330
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9330
>             Project: Hadoop Common
>          Issue Type: Test
>          Components: test
>    Affects Versions: 3.0.0
>            Reporter: Steve Loughran
>         Attachments: HADOOP-9330-timeouts-1.patch
>
>
> HADOOP-9112 has added a requirement for all new test methods to declare a 
> timeout, so that jenkins/maven builds will have better information on a 
> timeout.
> Hard coding timeouts into tests is dangerous as it will generate spurious 
> failures on slower machines/networks and when debugging a test.
> I propose providing a custom JUnit4 test runner that test cases can declare 
> as their test runner; this can provide timeouts specified at run-time, rather 
> than in-source.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to