hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Homan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-6987) Use JUnit Rule to optionally fail test cases that run more than 10 seconds
Date Tue, 05 Oct 2010 00:43:32 GMT

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

Jakob Homan commented on HADOOP-6987:
-------------------------------------

bq. I don't like unnecessary inheritance in tests. 
I'm not wild about them either, but one works with what one's got.

bq. what if we'll have tests which shouldn't go over 10 secs, and others (i.e. true unit tests)
which shouldn't exceed 2 secs
The current layout in HDFS is to have separate directory trees for the integration and (currently
sparsely populated) unit tests.  This implies we wouldn't be commingling the two types in
the same file, and this approach is predicated on that assumption.  I'm ok with either approach,
but if we're going to be combining types, we probably should collapse the directory trees
sooner than later.

If, on the other hand, we're separating unit and integration tests into different files, this
approach has the advantage that one can apply the rule to an entire file with only one line
(assuming the test is JUnit 4), rather than having to mark each and every test case with the
same annotation.  This approach thus has a smaller burden on the test writer and on any refactoring
we may want to do to implement it.

Also, it would be simple enough to write a script as part of test-patch to verify that all
tests in /unit are so marked and thus eligible to be in the unit category (although, it also
wouldn't be prohibitively difficult to write one to check each @Test annotation to include
a timeout value).



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


Mime
View raw message