Bug: Fix HBase TestCanaryTool for Java17
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 01/Nov/21 08:24

The UT TestCanaryTool will fail under Java17. The error message is 
{code:java}
[ERROR] org.apache.hadoop.hbase.tool.TestCanaryTool.testZookeeperCanaryPermittedFailuresArgumentWorks  Time elapsed: 7.994 s  <<< FAILURE!
Wanted but not invoked:
zookeeperStdOutSink.publishReadTiming(
    "/hbase",
    "localhost:52497",
    <any long>
);
-> at org.apache.hadoop.hbase.tool.TestCanaryTool.testZookeeperCanaryWithArgs(TestCanaryTool.java:390)

However, there were exactly 4 interactions with this mock:
zookeeperStdOutSink.publishReadFailure(
    "/hbase",
    "localhost/<unresolved>:52497"
);
-> at org.apache.hadoop.hbase.tool.CanaryTool$ZookeeperTask.call(CanaryTool.java:451)

zookeeperStdOutSink.incReadFailureCount();
-> at org.apache.hadoop.hbase.tool.CanaryTool$ZookeeperStdOutSink.publishReadFailure(CanaryTool.java:287)

zookeeperStdOutSink.getReadFailureCount();
-> at org.apache.hadoop.hbase.tool.CanaryTool$Monitor.finalCheckForErrors(CanaryTool.java:1325)

zookeeperStdOutSink.getWriteFailureCount();
-> at org.apache.hadoop.hbase.tool.CanaryTool$Monitor.finalCheckForErrors(CanaryTool.java:1326)


	at org.apache.hadoop.hbase.tool.TestCanaryTool.testZookeeperCanaryWithArgs(TestCanaryTool.java:390)
	at org.apache.hadoop.hbase.tool.TestCanaryTool.testZookeeperCanaryPermittedFailuresArgumentWorks(TestCanaryTool.java:108)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.apache.hadoop.hbase.SystemExitRule$1.evaluate(SystemExitRule.java:38)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.lang.Thread.run(Thread.java:833)
{code}