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

Andrew Purtell commented on HBASE-11819:
----------------------------------------

Hi [~talat], you would want to do something like:
- Create a new Medium test.
- Make a mocked coprocessor for the test. Have a look at some of the existing 
coprocessor unit tests for code examples. This coprocessor should have a test 
method that uses CoprocessorHConnection to connect to the test table and do a 
get from the region hosted locally.
- Initialize the minicluster with 3 slaves.
- Create a table with some data in it that has at least 3 regions, register the 
mocked coprocessor as a table coprocessor on this table.
- Verify the table regions are all assigned to different regionservers.
- Use the HBaseTestingUtility to get a handle to one regionserver. Get its 
coprocessor host and look up the coprocessor instance running there. Your 
coprocessor will know what region it is running on. You can get it using 
RegionCoprocessorEnvironment#getRegion. This will return a HRegion object. Use 
HRegion#getStartKey to find the start key for this region. 
- Invoke the test method of your coprocessor instance, passing the start key 
for the region. The test method should use this start key for a Get on the 
CoprocessorHConnection. Confirm that some data was actually returned.

The above would test for the bugfix on HBASE-11766.

I think we would also want an additional unit test that confirms the short 
circuit path was taken, but that would be more difficult to achieve so does not 
have to be done in the context of this issue. 

> Unit test for CoprocessorHConnection 
> -------------------------------------
>
>                 Key: HBASE-11819
>                 URL: https://issues.apache.org/jira/browse/HBASE-11819
>             Project: HBase
>          Issue Type: Test
>            Reporter: Andrew Purtell
>            Assignee: Talat UYARER
>            Priority: Minor
>              Labels: newbie++
>             Fix For: 2.0.0, 0.98.8, 0.99.1
>
>
> Add a unit test to hbase-server that exercises CoprocessorHConnection . 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to