You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "stack (Commented) (JIRA)" <ji...@apache.org> on 2011/10/01 01:25:45 UTC
[jira] [Commented] (HBASE-4448) HBaseTestingUtilityFactory -
pattern for re-using HBaseTestingUtility instances across unit tests
[ https://issues.apache.org/jira/browse/HBASE-4448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118567#comment-13118567 ]
stack commented on HBASE-4448:
------------------------------
bq. I think that HBaseClusterTestCase could be refactored to use HBaseTestingUtilityFactory to re-use the MiniCluster since they are all the same config.
Did as you suggested over in 'HBASE-4503 Purge deprecated HBaseClusterTestCase'
bq. Thanks Stack. In general, do you support the HBaseTestingUtilityFactory approach, where generic MiniClusters can be re-used (where-ever possible)?
I haven't reviewied it yet -- will do that later -- but I'm thinking I'm not in favor.
While playing with trying to have our tests run in parallel, I was reminded why we fork for each test.
We do this so there is isolation between test runs, so less chance of a test clobbering those that run later. Having it so the dietrus from one test run could dirty the context of the next test makes debugging test failures harder. Reusing the cluster also implies each test cleans up after itself. That might be too much to expect. Forking makes it hard to use this factory.
Back with more later.
> HBaseTestingUtilityFactory - pattern for re-using HBaseTestingUtility instances across unit tests
> -------------------------------------------------------------------------------------------------
>
> Key: HBASE-4448
> URL: https://issues.apache.org/jira/browse/HBASE-4448
> Project: HBase
> Issue Type: Improvement
> Reporter: Doug Meil
> Assignee: Doug Meil
> Priority: Minor
> Attachments: HBaseTestingUtilityFactory.java, hbase_hbaseTestingUtility_uses_2011_09_22.xlsx, java_HBASE_4448.patch, java_HBASE_4448_v2.patch
>
>
> Setting up and tearing down HBaseTestingUtility instances in unit tests is very expensive. On my MacBook it takes about 10 seconds to set up a MiniCluster, and 7 seconds to tear it down. When multiplied by the number of test classes that use this facility, that's a lot of time in the build.
> This factory assumes that the JVM is being re-used across test classes in the build, otherwise this pattern won't work.
> I don't think this is appropriate for every use, but I think it can be applicable in a great many cases - especially where developers just want a simple MiniCluster with 1 slave.
--
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