Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB2F1980D for ; Wed, 26 Sep 2012 19:25:07 +0000 (UTC) Received: (qmail 45930 invoked by uid 500); 26 Sep 2012 19:25:07 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 45881 invoked by uid 500); 26 Sep 2012 19:25:07 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 45872 invoked by uid 99); 26 Sep 2012 19:25:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Sep 2012 19:25:07 +0000 Date: Thu, 27 Sep 2012 06:25:07 +1100 (NCT) From: "stack (JIRA)" To: issues@hbase.apache.org Message-ID: <1735884259.130121.1348687507525.JavaMail.jiratomcat@arcas> In-Reply-To: <1598177507.127779.1348657087685.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (HBASE-6884) Update documentation on unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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. > 15.6.2.4. Running tests > Below we describe how to run the HBase junit categories. > 15.6.2.4.1. 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. > 15.6.2.4.2. 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 > 15.6.2.4.3. 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. > 15.6.2.4.4. 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