[
https://issues.apache.org/jira/browse/HADOOP-8755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454284#comment-13454284
]
Aaron T. Myers commented on HADOOP-8755:
----------------------------------------
Thanks for the update, Andrey. I agree that both of those improvements sound
good, though both could reasonably be done in separate JIRAs.
Regarding the difficulty of implementing option #2, I agree that both of those
sound pretty hacky, probably to the degree that it's not worth it. I don't even
think that dynamically modifying the @Test annotations for all the test methods
would work, since I don't think you can change annotation attributes at
run-time. I've also taken a look at the JUnit docs, and I think another way of
setting a default timeout might be to implement a custom BlockJUnit4ClassRunner
which overrides the withPotentialTimeout method to add a default value if none
is set. That's still not trivial, but it seems a little less hacky than either
of the two options so far proposed.
All that said, given the difficulty of setting a default JUnit test timeout,
I'd even be OK with just modifying all existing tests to set the timeout
attribute of the @Test annotation, and going forward being sure to always set
one. Considering we recently converted all of Hadoop's tests to JUnit 4 style,
this seems like it might be reasonable. I think we could very close to such a
patch just by doing the following:
{code}
sed -i 's/@Test$/@Test(timeout=480000)/g' `egrep -r '@Test$' . -l`
sed -i 's/@Test(expected/@Test(timeout=480000, expected/g' `egrep -r
'@Test\(expected' . -l`
{code}
Thoughts?
> Print thread dump when tests fail due to timeout
> -------------------------------------------------
>
> Key: HADOOP-8755
> URL: https://issues.apache.org/jira/browse/HADOOP-8755
> Project: Hadoop Common
> Issue Type: Improvement
> Components: test
> Affects Versions: 1.0.3, 0.23.1, 2.0.0-alpha
> Reporter: Andrey Klochkov
> Assignee: Andrey Klochkov
> Attachments: HDFS-3762-branch-0.23.patch, HDFS-3762.patch,
> HDFS-3762.patch, HDFS-3762.patch, HDFS-3762.patch, HDFS-3762.patch
>
>
> When a test fails due to timeout it's often not clear what is the root cause.
> See HDFS-3364 as an example.
> We can print dump of all threads in this case, this may help finding causes.
--
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