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

nkeywal commented on HBASE-4712:
--------------------------------

For 15s, it's fuzzy to help parallelization. But there are only a few tests 
that don't use a cluster and last more than 15s, I could give them a try.
org.apache.hadoop.hbase.io.hfile.slab.TestSingleSizeCache       5       24.294
org.apache.hadoop.hbase.io.hfile.slab.TestSlabCache     7       19.818
org.apache.hadoop.hbase.io.hfile.TestHFileBlock 7       25.226
org.apache.hadoop.hbase.regionserver.TestCompoundBloomFilter    3       22.694
org.apache.hadoop.hbase.regionserver.TestMemStore       21      28.672
org.apache.hadoop.hbase.regionserver.TestMultiColumnScanner     6       19.568
org.apache.hadoop.hbase.util.TestIdLock 1       15.198

Same for 50, and as well the longer it last, the more chance you have to get a 
flaky test :-)
The tests over 50s are:
org.apache.hadoop.hbase.catalog.TestCatalogTrackerOnCluster     1       84.463
org.apache.hadoop.hbase.client.TestAdmin        33      369.833
org.apache.hadoop.hbase.client.TestFromClientSide       49      154.41
org.apache.hadoop.hbase.client.TestMultipleTimestamps   8       66.497
org.apache.hadoop.hbase.client.TestShell        1       69.65
org.apache.hadoop.hbase.mapred.TestTableMapReduce       1       63.846
org.apache.hadoop.hbase.mapreduce.TestHFileOutputFormat 8       152.609
org.apache.hadoop.hbase.mapreduce.TestLoadIncrementalHFilesSplitRecovery        
3       74.628
org.apache.hadoop.hbase.mapreduce.TestTableInputFormatScan      11      516.619
org.apache.hadoop.hbase.mapreduce.TestTableMapReduce    1       92.144
org.apache.hadoop.hbase.master.TestDistributedLogSplitting      4       112.606
org.apache.hadoop.hbase.master.TestMasterFailover       4       76.658
org.apache.hadoop.hbase.master.TestRollingRestart       1       54.738
org.apache.hadoop.hbase.regionserver.wal.TestHLogSplit  28      230.379
org.apache.hadoop.hbase.regionserver.wal.TestHLog       9       59.889
org.apache.hadoop.hbase.regionserver.wal.TestLogRolling 3       310.537
org.apache.hadoop.hbase.replication.TestMasterReplication       2       75.346
org.apache.hadoop.hbase.replication.TestReplication     7       163.158
org.apache.hadoop.hbase.TestFullLogReconstruction       1       57.742
org.apache.hadoop.hbase.TestHBaseTestingUtility 7       73.654
org.apache.hadoop.hbase.TestRegionRebalancing   1       58.25
org.apache.hadoop.hbase.TestZooKeeper   7       86.267
org.apache.hadoop.hbase.util.TestMergeTool      1       257.223



                
> Document rules for writing tests
> --------------------------------
>
>                 Key: HBASE-4712
>                 URL: https://issues.apache.org/jira/browse/HBASE-4712
>             Project: HBase
>          Issue Type: Task
>          Components: test
>    Affects Versions: 0.92.0
>            Reporter: nkeywal
>            Assignee: nkeywal
>            Priority: Minor
>
> We saw that some tests could be improved. Documenting the general rules could 
> help.
> Proposal:
> HBase tests are divided in three categories: small, medium and large, with 
> corresponding JUnit categories: SmallTest, MediumTest, LargeTest
> Small tests are executed in parallel in a shared JVM. They must last less 
> than 15 seconds. They must NOT use a cluster.
> Medium tests are executed in separate JVM. They must last less than 50 
> seconds. They can use a cluster. They must not fail occasionally.
> Small and medium tests must not need more than 30 minutes to run altogether.
> Small and medium tests should be executed by the developers before submitting 
> a patch.
> Large tests are everything else. They are typically integration tests, 
> non-regression tests for specific bugs, timeout tests, performance tests.
> Tests rules & hints are:
> - As most as possible, tests should be written as small tests.
> - All tests should be written to support parallel execution on the same 
> machine, hence should not use shared resources as fixed ports or fixed file 
> names.
> - All tests should be written to be as fast as possible.
> - Tests should not overlog. More than 100 lines/second makes the logs complex 
> to read and use i/o that are hence not available for the other tests.
> - Tests can be written with HBaseTestingUtility . This class offers helper 
> function to create a temp directory and do the cleanup, or to start a cluster.
> - Sleeps:
>     - Tests should not do a 'Thread.sleep' without testing an ending 
> condition. This allows understanding what the test is waiting for. Moreover, 
> the test will work whatever the machine performances.
>     - Sleep should be minimal to be as fast as possible. Waiting for a 
> variable should be done in a 40ms sleep loop. Waiting for a socket operation 
> should be done in a 200 ms sleep loop.
> - Tests using cluster:
>     - Tests using a HRegion do not have to start a cluster: A region can use 
> the local file system.
>     - Start/stopping a cluster cost around 10 seconds. They should not be 
> started per test method but per class.
>     - Started cluster must be shutdown using 
> HBaseTestingUtility#shutdownMiniCluster, which cleans the directories.
>     - As most as possible, tests should use the default settings for the 
> cluster. When they don't, they should document it. This will allow to share 
> the cluster later.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to