hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wei-Chiu Chuang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-12610) Tests lose stack traces on failures
Date Wed, 02 Dec 2015 23:40:11 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-12610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15036877#comment-15036877
] 

Wei-Chiu Chuang commented on HADOOP-12610:
------------------------------------------

fail() in SymlinkBaseTest are different. They are called in try {} block, not in catch {}
block. They are used because the test expects the operations in try {} block to throw exceptions,
but instead they run through to the end of try {} block.

> Tests lose stack traces on failures
> -----------------------------------
>
>                 Key: HADOOP-12610
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12610
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: test
>            Reporter: Wei-Chiu Chuang
>            Assignee: Wei-Chiu Chuang
>            Priority: Minor
>              Labels: supportability
>
> I saw a test failure in TestCompressorDecompressor.testCompressorDecompressor
> with the output
> Error Message
> {noformat}
> testCompressorDecompressor error !!!java.lang.NullPointerException
> {noformat}
> Stacktrace
> {noformat}
> java.lang.AssertionError: testCompressorDecompressor error !!!java.lang.NullPointerException
> 	at org.junit.Assert.fail(Assert.java:88)
> 	at org.apache.hadoop.io.compress.TestCompressorDecompressor.testCompressorDecompressor(TestCompressorDecompressor.java:69)
> {noformat}
> However, this message does not expose the origin of the exception, nor does it print
the error message. This makes debugging impossible. I also found the similar practice exists
in multiple test files:
> {noformat}
> ~/hadoop/hadoop-common-project/hadoop-common ((c21a801...)) $ grep -r "fail(.*+ e" .|less
> ./src/test/java/org/apache/hadoop/net/TestNetworkTopologyWithNodeGroup.java:        fail("Expecting
IllegalArgumentException, but caught:" + e);
> ./src/test/java/org/apache/hadoop/io/nativeio/TestNativeIO.java:      fail("Got unexpected
exception: " + e.getMessage());
> ./src/test/java/org/apache/hadoop/io/nativeio/TestNativeIO.java:        fail("Got unexpected
exception: " + e.getMessage());
> ./src/test/java/org/apache/hadoop/io/nativeio/TestNativeIO.java:      fail("Got unexpected
exception: " + e.getMessage());
> ./src/test/java/org/apache/hadoop/io/TestMapFile.java:      fail("testRename error "
+ ex);
> ./src/test/java/org/apache/hadoop/io/compress/snappy/TestSnappyCompressorDecompressor.java:
     fail("testSnappyDirectBlockCompression ex !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("testCompressorDecompressor error !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("testCompressorDecompressorWithExeedBufferLimit error !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
       fail("testZlibCompressorDecompressorWithConfiguration ex error " + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("testZlibCompressDecompress ex !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("testZlibDirectCompressDecompress ex !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("testBuiltInGzipDecompressorExceptions npe error " + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("testBuiltInGzipDecompressorExceptions aioob error" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("invalid 0 and 1 byte in gzip stream" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("invalid 2 byte in gzip stream" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("invalid 3 byte in gzip stream" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java:
     fail("invalid 3 byte make hasExtraField" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/TestCompressorDecompressor.java:      fail("testCompressorDecompressor
error !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/TestCompressorDecompressor.java:      fail("testCompressorDecompressorWithExeedBufferLimit
error !!!" + ex);
> ./src/test/java/org/apache/hadoop/io/compress/TestBlockDecompressorStream.java:     
fail("unexpected IOException : " + e);
> ./src/test/java/org/apache/hadoop/io/compress/bzip2/TestBzip2CompressorDecompressor.java:
     fail("testBzip2CompressDecompress ex !!!" + ex);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail(""
+ e);
> ./src/test/java/org/apache/hadoop/util/bloom/BloomFilterCommonTester.java:          Assert.fail("error
ex !!!" + ex);
> ./src/test/java/org/apache/hadoop/util/TestShell.java:      fail("Expected an exception
with the text `" + expectedText + "`"
> ./src/test/java/org/apache/hadoop/util/TestShell.java:      fail("Expected an exception
with the text `" + expectedText + "`"
> ./src/test/java/org/apache/hadoop/tracing/SetSpanReceiver.java:      Assert.fail("timed
out to get expected spans: " + e.getMessage());
> ./src/test/java/org/apache/hadoop/tracing/SetSpanReceiver.java:      Assert.fail("interrupted
while waiting spans: " + e.getMessage());
> ./src/test/java/org/apache/hadoop/ipc/TestRPCCompatibility.java:      fail("Expected
version mismatch but got " + ex);
> ./src/test/java/org/apache/hadoop/ipc/TestRPC.java:        fail("Expecting HadoopIllegalArgumentException
but caught " + e);
> ./src/test/java/org/apache/hadoop/ipc/TestRPC.java:        fail("Expecting HadoopIllegalArgumentException
but caught " + e);
> ./src/test/java/org/apache/hadoop/ipc/TestRPC.java:        fail("Expecting HadoopIllegalArgumentException
but caught " + e);
> ./src/test/java/org/apache/hadoop/security/token/delegation/TestDelegationToken.java:
     Assert.fail("action did not throw " + except);
> {noformat}
> I am filing this JIRA to make failure messages more verbose and make debugging easier.
There are of course similar patterns in other part of Hadoop codebase, but I am starting with
this one because I do see test failures here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message