hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-6884) Update documentation on unit tests
Date Wed, 26 Sep 2012 19:25:07 GMT

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

stack commented on HBASE-6884:

Committed addendum. Thanks N.  Thats clearer.
> Update documentation on unit tests
> ----------------------------------
>                 Key: HBASE-6884
>                 URL: https://issues.apache.org/jira/browse/HBASE-6884
>             Project: HBase
>          Issue Type: Improvement
>          Components: documentation
>    Affects Versions: 0.96.0
>            Reporter: nkeywal
>            Assignee: nkeywal
>            Priority: Minor
>             Fix For: 0.96.0
>         Attachments: 6884-addendum.txt, 6884.txt
> Points to address:
> - we don't have anymore JUnit rules in the tests
> - we should document how to run the test faster.
> - some stuff is not used (run only a category) and should be removed from the doc imho.
> Below the proposal:
> --
> 15.6.2. Unit Tests
> HBase unit tests are subdivided into three categories: small, medium and large, with
corresponding JUnit categories: SmallTests, MediumTests, LargeTests. JUnit categories are
denoted using java annotations and look like this in your unit test code.
> ...
> @Category(SmallTests.class)
> public class TestHRegionInfo {
>   @Test
>   public void testCreateHRegionInfoName() throws Exception {
>     // ...
>   }
> }
> The above example shows how to mark a test as belonging to the small category. HBase
uses a patched maven surefire plugin and maven profiles to implement its unit test characterizations.

> Running tests
> Below we describe how to run the HBase junit categories.
> Default: small and medium category tests
> Running
> mvn test
> will execute all small tests in a single JVM (no fork) and then medium tests in a separate
JVM for each test instance. Medium tests are NOT executed if there is an error in a small
test. Large tests are NOT executed. There is one report for small tests, and one report for
medium tests if they are executed.
> Running all tests
> Running
> mvn test -P runAllTests
> will execute small tests in a single JVM then medium and large tests in a separate JVM
for each test. Medium and large tests are NOT executed if there is an error in a small test.
Large tests are NOT executed if there is an error in a small or medium test. There is one
report for small tests, and one report for medium and large tests if they are executed
> Running a single test or all tests in a package
> To run an individual test, e.g. MyTest, do
> mvn test -P localTests -Dtest=MyTest
> You can also pass multiple, individual tests as a comma-delimited list:
> mvn test -P localTests -Dtest=MyTest1,MyTest2,MyTest3
> You can also pass a package, which will run all tests under the package:
> mvn test -P localTests -Dtest=org.apache.hadoop.hbase.client.*
> The -P localTests will remove the JUnit category effect (without this specific profile,
the categories are taken into account). Each junit tests is executed in a separate JVM (A
fork per test class). There is no parallelization when localTests profile is set. You will
see a new message at the end of the report: "[INFO] Tests are skipped". It's harmless.
> Running test faster
> [replace previous chapter]
> By default, mvn test -P runAllTests runs 5 tests in parallel. It can be increased for
many developper machine. Consider that you can have 2 tests in parallel per core, and you
need about 2Gb of memory per test. Hence, if you have a 8 cores and 24Gb box, you can have
16 tests in parallel.
> The setting is:
> mvn test -P runAllTests -Dsurefire.secondPartThreadCount=12
> To increase the speed, you can as well use a ramdisk. You will need 2Gb of memory to
run all the test. You will also need to delete the files between two test run.
> The typical way to configure a ramdisk on Linux is:
> sudo mkdir /ram2G
> sudo mount -t tmpfs -o size=2048M tmpfs /ram2G
> You can then use it to run all HBase tests with the command:
> mvn test -P runAllTests -Dsurefire.secondPartThreadCount=8 -Dtest.build.data.basedirectory=/ram2G

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

View raw message