You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/09/26 02:19:59 UTC
[8/8] hbase git commit: HBASE-18830 TestCanaryTool does not check
Canary monitor's error code
HBASE-18830 TestCanaryTool does not check Canary monitor's error code
Added assertion checks to make sure that the error code for the
ToolRunner run() method is used.
Testing Done: Checked that TestCanaryTool unit tests fail when there is
an error code in the current Canary run.
Signed-off-by: Andrew Purtell <ap...@apache.org>
Conflicts:
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/decf9d62
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/decf9d62
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/decf9d62
Branch: refs/heads/branch-1.4
Commit: decf9d6235e23a1e0b2bb4ea315079c513c8e059
Parents: eace8b1
Author: Chinmay Kulkarni <ch...@gmail.com>
Authored: Fri Sep 15 17:06:52 2017 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Sep 25 19:17:26 2017 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/tool/TestCanaryTool.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/decf9d62/hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java
index 0204582..2206a16 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestCanaryTool.java
@@ -90,7 +90,7 @@ public class TestCanaryTool {
Canary.ZookeeperStdOutSink sink = spy(new Canary.ZookeeperStdOutSink());
Canary canary = new Canary(executor, sink);
String[] args = { "-t", "10000", "-zookeeper" };
- ToolRunner.run(testingUtility.getConfiguration(), canary, args);
+ assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args));
String baseZnode = testingUtility.getConfiguration()
.get(HConstants.ZOOKEEPER_ZNODE_PARENT, HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
@@ -113,7 +113,7 @@ public class TestCanaryTool {
Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink());
Canary canary = new Canary(executor, sink);
String[] args = { "-writeSniffing", "-t", "10000", "testTable" };
- ToolRunner.run(testingUtility.getConfiguration(), canary, args);
+ assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args));
assertEquals("verify no read error count", 0, canary.getReadFailures().size());
assertEquals("verify no write error count", 0, canary.getWriteFailures().size());
verify(sink, atLeastOnce()).publishReadTiming(isA(ServerName.class), isA(HRegionInfo.class), isA(HColumnDescriptor.class), anyLong());
@@ -142,7 +142,7 @@ public class TestCanaryTool {
String configuredTimeoutStr = tableNames[0].getNameAsString() + "=" + Long.MAX_VALUE + "," +
tableNames[1].getNameAsString() + "=0";
String[] args = { "-readTableTimeouts", configuredTimeoutStr, tableNames[0].getNameAsString(), tableNames[1].getNameAsString()};
- ToolRunner.run(testingUtility.getConfiguration(), canary, args);
+ assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args));
verify(sink, times(tableNames.length)).initializeAndGetReadLatencyForTable(isA(String.class));
for (int i=0; i<2; i++) {
assertNotEquals("verify non-null read latency", null, sink.getReadLatencyMap().get(tableNames[i].getNameAsString()));
@@ -170,7 +170,7 @@ public class TestCanaryTool {
Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink());
Canary canary = new Canary(executor, sink);
String[] args = { "-writeSniffing", "-writeTableTimeout", String.valueOf(Long.MAX_VALUE)};
- ToolRunner.run(testingUtility.getConfiguration(), canary, args);
+ assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args));
assertNotEquals("verify non-null write latency", null, sink.getWriteLatency());
assertNotEquals("verify non-zero write latency", 0L, sink.getWriteLatency());
verify(mockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@@ -224,7 +224,7 @@ public class TestCanaryTool {
String[] args = { "-t", "10000", "testTableRawScan" };
org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(testingUtility.getConfiguration());
conf.setBoolean(HConstants.HBASE_CANARY_READ_RAW_SCAN_KEY, true);
- ToolRunner.run(conf, canary, args);
+ assertEquals(0, ToolRunner.run(conf, canary, args));
verify(sink, atLeastOnce())
.publishReadTiming(isA(ServerName.class), isA(HRegionInfo.class), isA(HColumnDescriptor.class), anyLong());
assertEquals("verify no read error count", 0, canary.getReadFailures().size());
@@ -234,7 +234,7 @@ public class TestCanaryTool {
ExecutorService executor = new ScheduledThreadPoolExecutor(1);
Canary canary = new Canary(executor, new Canary.RegionServerStdOutSink());
String[] args = { "-t", "10000", "-regionserver"};
- ToolRunner.run(testingUtility.getConfiguration(), canary, args);
+ assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args));
assertEquals("verify no read error count", 0, canary.getReadFailures().size());
}