From 423ab02564c6203204709a684544e52c416232d3 Mon Sep 17 00:00:00 2001 From: Steve Vaughan Jr Date: Fri, 29 Jul 2022 14:40:56 -0400 Subject: [PATCH 1/2] HDFS-16702. MiniDFSCluster should report cause of exception in assertion error --- .../test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java index 484958e3c302c..16ccca18b7c7a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java @@ -2159,10 +2159,10 @@ public void shutdown(boolean deleteDfsDir, boolean closeFileSystem) { LOG.info("Shutting down the Mini HDFS Cluster"); if (checkExitOnShutdown) { if (ExitUtil.terminateCalled()) { - LOG.error("Test resulted in an unexpected exit", - ExitUtil.getFirstExitException()); + Exception cause = ExitUtil.getFirstExitException(); + LOG.error("Test resulted in an unexpected exit", cause); ExitUtil.resetFirstExitException(); - throw new AssertionError("Test resulted in an unexpected exit"); + throw new AssertionError("Test resulted in an unexpected exit", cause); } } if (closeFileSystem) { From 46ebe2ee0097ff476d32c14f5d2837fad54bd312 Mon Sep 17 00:00:00 2001 From: Steve Vaughan Jr Date: Tue, 9 Aug 2022 10:16:51 -0400 Subject: [PATCH 2/2] Include the cause in the message --- .../src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java index 16ccca18b7c7a..c4e99b1833a06 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java @@ -2162,7 +2162,8 @@ public void shutdown(boolean deleteDfsDir, boolean closeFileSystem) { Exception cause = ExitUtil.getFirstExitException(); LOG.error("Test resulted in an unexpected exit", cause); ExitUtil.resetFirstExitException(); - throw new AssertionError("Test resulted in an unexpected exit", cause); + throw new AssertionError("Test resulted in an unexpected exit: " + + cause.toString(), cause); } } if (closeFileSystem) {