infraio commented on a change in pull request #1817:
URL: https://github.com/apache/hbase/pull/1817#discussion_r433668219
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java
##########
@@ -129,6 +132,56 @@ public void testBasicCanaryWorks() throws Exception {
isA(ColumnFamilyDescriptor.class), anyLong());
}
+ @Test
+ public void testCanaryRegionTaskReadAllCF() throws Exception {
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ Table table = testingUtility.createTable(tableName,
+ new byte[][] { Bytes.toBytes("f1"), Bytes.toBytes("f2") });
+ // insert some test rows
+ for (int i = 0; i < 1000; i++) {
+ byte[] iBytes = Bytes.toBytes(i);
+ Put p = new Put(iBytes);
+ p.addColumn(Bytes.toBytes("f1"), COLUMN, iBytes);
+ p.addColumn(Bytes.toBytes("f2"), COLUMN, iBytes);
+ table.put(p);
+ }
+ ExecutorService executor = new ScheduledThreadPoolExecutor(1);
+ CanaryTool.RegionStdOutSink sink = spy(new CanaryTool.RegionStdOutSink());
+ CanaryTool canary = new CanaryTool(executor, sink);
+ String[] args = { "-t", "10000", "testCanaryRegionTaskReadAllCF" };
+ Configuration configuration =
HBaseConfiguration.create(testingUtility.getConfiguration());
+ configuration.setBoolean(HConstants.HBASE_CANARY_READ_ALL_CF, false);
+ assertEquals(0, ToolRunner.run(configuration, canary, args));
+
+ assertTrue("canary should expect to scan at least 1 region",
+ sink.getTotalExpectedRegions() > 0);
+ assertTrue("there should be no read failures", sink.getReadFailureCount()
== 0);
+ assertTrue("there should be no write failures",
sink.getWriteFailureCount() == 0);
+ assertTrue("verify read success count > 0", sink.getReadSuccessCount() >
0);
+ verify(sink, atLeastOnce()).publishReadTiming(isA(ServerName.class),
isA(RegionInfo.class),
+ isA(ColumnFamilyDescriptor.class), anyLong());
+
+ assertEquals("canary region success count should equal total expected
regions",
Review comment:
Add some comment for test? If HBASE_CANARY_READ_ALL_CF config to true,
the difference is?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]