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

Surenkumar Nihalani commented on HADOOP-9112:
---------------------------------------------

while adding default timeout sounds like a patch but not the solution. I was 
looking at reflection's API. It's good enough for us to check Timeout for each 
Test annotation (assuming the test follows JUnit 4 format) however for it to 
work we need a class object to start with. There are two ways to get that
# From an instance, like, {{instance.getClass()}}
# From the fully qualified name String, like: {{Class c = 
Class.forName("com.duke.MyLocaleServiceProvider");}}

Getting an instance of the instance of the test object seems to be tough. 
Using the fully qualified name seems to be a good approach to do this. Now, 
from a given file path, there is no clean way to get to fully qualified name. I 
think grepping for "package *;" and "public class [w]+ " and concatenating 
results and passing it down to a java program as an argument should be do-able.

After I have a reference to a class object, it's easy to check if all the 
methods have annotations of junit.Test instance have a timeout variable.

Thoughts?
                
> test-patch should -1 for @Tests without a timeout
> -------------------------------------------------
>
>                 Key: HADOOP-9112
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9112
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Todd Lipcon
>
> With our current test running infrastructure, if a test with no timeout set 
> runs too long, it triggers a surefire-wide timeout, which for some reason 
> doesn't show up as a failed test in the test-patch output. Given that, we 
> should require that all tests have a timeout set, and have test-patch enforce 
> this with a simple check

--
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