You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Appy (JIRA)" <ji...@apache.org> on 2018/01/28 02:58:02 UTC

[jira] [Comment Edited] (HBASE-19873) Add a CategoryBasedTimeout ClassRule for all UTs

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

Appy edited comment on HBASE-19873 at 1/28/18 2:57 AM:
-------------------------------------------------------

I was thinking about this approach more during skiing, and got another idea. Let me try that quickly too.
It's basically this-  We can use RunListener to add timeout rule to every test class *via reflection* before it gets started. The only thing to verify is, will junit pick up this dynamic runtime addition of rules to test class.

If it works, we won't have to add the Timeout rule to each and every test class. That'll be a big win. Trying...
----
Btw, when researching more about that, i found this:
bq. The statement passed to the TestRule will never throw an exception, and throwing an exception from the TestRule will result in undefined behavior. This means that some TestRules, such as ErrorCollector, ExpectedException, and Timeout, have undefined behavior when used as ClassRules.
Ref:http://junit.org/junit4/javadoc/4.12/org/junit/ClassRule.html




was (Author: appy):
I was thinking about this approach more during skiing, and got another idea. Let me try that quickly too.
It's basically this-  We can use RunListener to add timeout rule to every test class *via reflection* before it gets started. The only thing to verify is, will junit pick up this dynamic runtime addition of rules to test class.

If it works, we won't have to add the Timeout rule to each and every test class. That'll be a big win. Trying...

Btw, when researching more about that, i found this:
bq. The statement passed to the TestRule will never throw an exception, and throwing an exception from the TestRule will result in undefined behavior. This means that some TestRules, such as ErrorCollector, ExpectedException, and Timeout, have undefined behavior when used as ClassRules.
Ref:http://junit.org/junit4/javadoc/4.12/org/junit/ClassRule.html



> Add a CategoryBasedTimeout ClassRule for all UTs
> ------------------------------------------------
>
>                 Key: HBASE-19873
>                 URL: https://issues.apache.org/jira/browse/HBASE-19873
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>            Priority: Major
>             Fix For: 2.0.0-beta-2
>
>         Attachments: HBASE-19873-v1.patch
>
>
> So that our test can timeout as expected without making the surefire plugin kill other tests.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)