You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Enoch Hsu <eh...@us.ibm.com> on 2014/04/16 19:22:50 UTC

Question about Writing Unit Tests for JIRA 10950

Hi All,

I am looking into JIRA 10950 and I have a couple questions about writing
unit tests for the patch.
Where should the unit tests go in terms of module and package location?
e.g. hbase-server, hbase-client, etc

Another thing I observed while trying to write unit tests is that
HBaseTestingUtility has its own configuration files
that are used once the minicluster is started, and, unless I pass the
minicluster's configuration file to my code,
any new Configuration() calls will not get the same configuration as the
minicluster.
Is there any way to get HBaseTestingUtility and HBaseConfiguration.create()
to interact with each other without passing the conf object around?
Or is there another way I should be going about writing unit tests for
this?

Thanks,
Enoch Hsu

Re: Question about Writing Unit Tests for JIRA 10950

Posted by Ted Yu <yu...@gmail.com>.
There is no patch posted so I don't know what classes you're modifying.

If the changes are mostly in hbase-client module, the test(s) should be in
the same module.

w.r.t. Configuration, you can obtain it using the following code where
TEST_UTIL is an instance of HBaseTestingUtility:

    Configuration conf = TEST_UTIL.getConfiguration();

Refer to existing tests such as TestFromClientSide

Cheers


On Wed, Apr 16, 2014 at 10:22 AM, Enoch Hsu <eh...@us.ibm.com> wrote:

>
> Hi All,
>
> I am looking into JIRA 10950 and I have a couple questions about writing
> unit tests for the patch.
> Where should the unit tests go in terms of module and package location?
> e.g. hbase-server, hbase-client, etc
>
> Another thing I observed while trying to write unit tests is that
> HBaseTestingUtility has its own configuration files
> that are used once the minicluster is started, and, unless I pass the
> minicluster's configuration file to my code,
> any new Configuration() calls will not get the same configuration as the
> minicluster.
> Is there any way to get HBaseTestingUtility and HBaseConfiguration.create()
> to interact with each other without passing the conf object around?
> Or is there another way I should be going about writing unit tests for
> this?
>
> Thanks,
> Enoch Hsu