virajjasani commented on a change in pull request #3308:
URL: https://github.com/apache/hbase/pull/3308#discussion_r640376122
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/TestClusterPortAssignment.java
##########
@@ -67,17 +72,22 @@ public void testClusterPortAssignment() throws Exception {
assertEquals("RS info port is incorrect", rsInfoPort,
cluster.getRegionServer(0).getInfoServer().getPort());
} catch (Exception e) {
- if (e instanceof BindException || e.getCause() != null &&
- (e.getCause() instanceof BindException || e.getCause().getCause()
!= null &&
- e.getCause().getCause() instanceof BindException)) {
+ Throwable rootCause = ExceptionUtils.getRootCause(e);
+ if (rootCause instanceof BindException) {
LOG.info("Failed bind, need to retry", e);
retry = true;
+ retryCount++;
} else {
- throw e;
+ retry = false;
+ fail("Failed to start mini cluster" + e);
Review comment:
Rather than including Exception message with Assert.fail, let's log it
separately just above this line (similar to `if` part) and here we can exclude
it from `fail`.
When it fails here, we can check full stacktrace in log anyways.
--
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]