diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStream.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStream.java index a5d60c4b41..66f072501d 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStream.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStream.java @@ -81,7 +81,7 @@ protected void testWithNoOptimization(final FileSystem fs, } assertEquals(length, bytesRead); assertContentReadCorrectly(fileContent, - (int) (seekPos + totalBytesRead - length), length, buffer); + (int) (seekPos + totalBytesRead - length), length, buffer, testFilePath); assertTrue(abfsInputStream.getFCursor() >= seekPos + totalBytesRead); assertTrue(abfsInputStream.getFCursorAfterLastRead() >= seekPos + totalBytesRead); @@ -133,7 +133,7 @@ private void testExceptionInOptimization(final FileSystem fs, actualLength = length - delta; } assertEquals(bytesRead, actualLength); - assertContentReadCorrectly(fileContent, seekPos, (int) actualLength, buffer); + assertContentReadCorrectly(fileContent, seekPos, (int) actualLength, buffer, testFilePath); assertEquals(fileContent.length, abfsInputStream.getFCursor()); assertEquals(fileContent.length, abfsInputStream.getFCursorAfterLastRead()); assertEquals(actualLength, abfsInputStream.getBCursor()); @@ -200,24 +200,24 @@ protected Map getInstrumentationMap(FileSystem fs) } protected void assertContentReadCorrectly(byte[] actualFileContent, int from, - int len, byte[] contentRead) { + int len, byte[] contentRead, Path testFilePath) { for (int i = 0; i < len; i++) { - assertEquals(contentRead[i], actualFileContent[i + from]); + assertEquals("The test file path is " + testFilePath, contentRead[i], actualFileContent[i + from]); } } protected void assertBuffersAreNotEqual(byte[] actualContent, - byte[] contentRead, AbfsConfiguration conf) { - assertBufferEquality(actualContent, contentRead, conf, false); + byte[] contentRead, AbfsConfiguration conf, Path testFilePath) { + assertBufferEquality(actualContent, contentRead, conf, false, testFilePath); } protected void assertBuffersAreEqual(byte[] actualContent, byte[] contentRead, - AbfsConfiguration conf) { - assertBufferEquality(actualContent, contentRead, conf, true); + AbfsConfiguration conf, Path testFilePath) { + assertBufferEquality(actualContent, contentRead, conf, true, testFilePath); } private void assertBufferEquality(byte[] actualContent, byte[] contentRead, - AbfsConfiguration conf, boolean assertEqual) { + AbfsConfiguration conf, boolean assertEqual, Path testFilePath) { int bufferSize = conf.getReadBufferSize(); int actualContentSize = actualContent.length; int n = (actualContentSize < bufferSize) ? actualContentSize : bufferSize; @@ -228,9 +228,9 @@ private void assertBufferEquality(byte[] actualContent, byte[] contentRead, } } if (assertEqual) { - assertEquals(n, matches); + assertEquals("The test file path is " + testFilePath, n, matches); } else { - assertNotEquals(n, matches); + assertNotEquals("The test file path is " + testFilePath, n, matches); } } diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamReadFooter.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamReadFooter.java index 1cb8ed3ea8..cb3eaffe02 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamReadFooter.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamReadFooter.java @@ -235,14 +235,14 @@ private void seekReadAndTest(final FileSystem fs, final Path testFilePath, assertEquals(expectedBCurson, abfsInputStream.getBCursor()); assertEquals(actualLength, bytesRead); // Verify user-content read - assertContentReadCorrectly(fileContent, seekPos, (int) actualLength, buffer); + assertContentReadCorrectly(fileContent, seekPos, (int) actualLength, buffer, testFilePath); // Verify data read to AbfsInputStream buffer int from = seekPos; if (optimizationOn) { from = (int) max(0, actualContentLength - bufferSize); } assertContentReadCorrectly(fileContent, from, (int) abfsInputStream.getLimit(), - abfsInputStream.getBuffer()); + abfsInputStream.getBuffer(), testFilePath); } } @@ -280,7 +280,7 @@ private void testPartialReadWithNoData(final FileSystem fs, byte[] buffer = new byte[length]; int bytesRead = iStream.read(buffer, 0, length); assertEquals(length, bytesRead); - assertContentReadCorrectly(fileContent, seekPos, length, buffer); + assertContentReadCorrectly(fileContent, seekPos, length, buffer, testFilePath); assertEquals(fileContent.length, abfsInputStream.getFCursor()); assertEquals(length, abfsInputStream.getBCursor()); assertTrue(abfsInputStream.getLimit() >= length); diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamSmallFileReads.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamSmallFileReads.java index d85da5aaea..baa664d6e7 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamSmallFileReads.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsInputStreamSmallFileReads.java @@ -189,7 +189,7 @@ private void seekReadAndTest(FileSystem fs, Path testFilePath, int seekPos, byte[] buffer = new byte[length]; int bytesRead = iStream.read(buffer, 0, length); assertEquals(bytesRead, length); - assertContentReadCorrectly(fileContent, seekPos, length, buffer); + assertContentReadCorrectly(fileContent, seekPos, length, buffer, testFilePath); AbfsInputStream abfsInputStream = (AbfsInputStream) iStream .getWrappedStream(); @@ -199,16 +199,16 @@ private void seekReadAndTest(FileSystem fs, Path testFilePath, int seekPos, int expectedLimit, expectedFCursor; int expectedBCursor; if (conf.readSmallFilesCompletely() && smallFile) { - assertBuffersAreEqual(fileContent, abfsInputStream.getBuffer(), conf); + assertBuffersAreEqual(fileContent, abfsInputStream.getBuffer(), conf, testFilePath); expectedFCursor = fileContentLength; expectedLimit = fileContentLength; expectedBCursor = seekPos + length; } else { if ((seekPos == 0)) { - assertBuffersAreEqual(fileContent, abfsInputStream.getBuffer(), conf); + assertBuffersAreEqual(fileContent, abfsInputStream.getBuffer(), conf, testFilePath); } else { assertBuffersAreNotEqual(fileContent, abfsInputStream.getBuffer(), - conf); + conf, testFilePath); } expectedBCursor = length; expectedFCursor = (fileContentLength < (seekPos + readBufferSize)) @@ -260,7 +260,7 @@ private void partialReadWithNoData(final FileSystem fs, byte[] buffer = new byte[length]; int bytesRead = iStream.read(buffer, 0, length); assertEquals(bytesRead, length); - assertContentReadCorrectly(fileContent, seekPos, length, buffer); + assertContentReadCorrectly(fileContent, seekPos, length, buffer, testFilePath); assertEquals(fileContent.length, abfsInputStream.getFCursor()); assertEquals(fileContent.length, abfsInputStream.getFCursorAfterLastRead());