[
https://issues.apache.org/jira/browse/HBASE-19948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16354851#comment-16354851
]
stack commented on HBASE-19948:
-------------------------------
bq. I think we could change the javadoc and refguide about these annotations?
We could. But lets work out their new definitions before we do that -- and that
we want to even go there.
I think the change in HBASE-19873 rendors the small/medium/large categories
meaningless Now it is about time-taken by the test-suite rather than a test
method. A SmallTest used few resources so it could run inside a few seconds.
Now a test-suite/class can launch clusters and if only one test method in the
test suite, as long as it finished inside 60 seconds, its a 'small' test though
in the old manner of categorization, it would have been a 'large' test. A
test-suite that ran lots of test methods of a few seconds each now can break
the SmallTest barrier if it in total takes longer than 60seconds.
Build time, we relied on small tests not using much by way of resources and we
ran a bunch of them together, concurrently in the one JVM and it usually
worked. We staged the test run so we did small first. We'd fail the build fast
if change was dumb.
bq. But for us this is not true, as most developers do not take care about the
conflicts between test methods so a parallel run will be easy to cause test
failure...
Maybe for medium and large tests but for small tests, it seems to work well
currently. I can even crank up the concurrency and in the one JVM get all
smalltests to pass stilll...
Thanks [~Apache9]
Yeah, the @Rule vs @ClassRule context makes changing this a pain; thats why I
assigned this myself.
Lets keep chatting and figure what we want here. [~appy] you have an opinion
boss?
> Since HBASE-19873, HBaseClassTestRule, Small/Medium/Large has different
> semantic
> --------------------------------------------------------------------------------
>
> Key: HBASE-19948
> URL: https://issues.apache.org/jira/browse/HBASE-19948
> Project: HBase
> Issue Type: Bug
> Reporter: stack
> Assignee: stack
> Priority: Major
> Fix For: 2.0.0-beta-2
>
>
> I was confused on how SmallTest/MediumTest/LargeTest were being interpreted
> since HBASE-19873 where we added HBaseClassTestRule enforcing a ClassRule.
> Small/Medium/Large are defined up in the refguide here:
> http://hbase.apache.org/book.html#hbase.unittests
> E.g: "Small test cases are executed in a shared JVM and individual test cases
> should run in 15 seconds or less..."
> I've always read the above as each method in a test suite/class should take
> 15 seconds (see below for finding by [~appy] [1]).
> The old CategoryBasedTimeout annotation used to try and enforce a test method
> taking only its designated category amount of time.
> The JUnit Timeout Rule talks about enforcing the timeout per test method:
> https://junit.org/junit4/javadoc/4.12/org/junit/rules/Timeout.html
> The above meant that you could have as many tests as you wanted in a
> class/suite and it could run as along as you liked as along as each
> individual test stayed within its category-based elapsed amount of time (and
> the whole suite completed inside the surefire fork timeout of 15mins).
> Then came HBASE-19873 which addressed an awkward issue around accounting for
> time spent in startup/shutdown -- i.e. time taken outside of a test method
> run -- and trying to have a timeout that cuts in before the surefire fork one
> does. It ended up adding a ClassRule that set a timeout on the whole test
> *suite/class* -- Good -- but the timeout set varies dependent upon the test
> category. A suite/class with 60 small tests that each take a second to
> complete now times out if you add one more test to the suite (61 seconds > 60
> seconds timeout -- give or take vagaries of the platform you run the test on).
> This latter change I have trouble with. It changes how small/medium/large
> have classically been understood. I think it will confuse too as now devs
> must do careful counting of test methods per class; one fat one (i.e.
> 'large') is same as N small ones. Could we set a single timeout on the whole
> test suite/class, one that was well less than the surefire fork kill timeout
> of 900seconds but keep the old timeout on each method as we used to have with
> the category-based annotation?
> (Am just looking for agreement that we have a problem here and that we want
> categories to be per test method as it used be; how to do it doesn't look
> easy and is for later).
> 1. @appy pointed out that the actual SmallTest annotation says something
> other than what is in the refguide: "Tag a test as 'small', meaning that the
> test class has the following characteristics: ....ideally, last less than 15
> seconds...."
> https://github.com/apache/hbase/blob/master/hbase-annotations/src/test/java/org/apache/hadoop/hbase/testclassification/SmallTests.java#L22
> 2. Here is code to show how timeout has changed now... previous the below
> would have 'run' without timing out.
> @Category({SmallTests.class})
> public class TestTimingOut {
> @ClassRule
> public static final HBaseClassTestRule CLASS_RULE =
> HBaseClassTestRule.forClass(TestTimingOut.class);
> @Test
> public void oneTest() {
> Threads.sleep(14000);
> }
> @Test
> public void twoTest() {
> Threads.sleep(14000);
> }
> @Test
> public void threeTest() {
> Threads.sleep(14000);
> }
> @Test
> public void fourTest() {
> Threads.sleep(14000);
> }
> @Test
> public void fiveTest() {
> Threads.sleep(14000);
> }
> }
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)