New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-17765. ABFS: Use Unique File Paths in Tests #3153
Conversation
TEST RESULTS HNS Account Location: East US 2
Existing JIRAs to track failures: AppendBlob StreamOps test, LMT, ReadWriteandSeek, testDistCpWithIterator, Lease IO error |
...ls/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
- I'd prefer to go with
path()
overgetUniquePath()
as that's what's been used elsewhere and it'll make copying tests between modules easier. - changes to assertions should take the opportunity to assertPathExists/assertPathDoesNotExist where possible. These are much more useful on test failure
@@ -443,6 +445,16 @@ protected Path path(String filepath) throws IOException { | |||
new Path(getTestPath(), filepath)); | |||
} | |||
|
|||
/** | |||
* Generate a unique path using the given filepath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add .
fs.delete(EXISTED_FOLDER_PATH, true); | ||
assertFalse(fs.exists(EXISTED_FOLDER_PATH)); | ||
fs.delete(existedFolderPath, true); | ||
assertFalse(fs.exists(existedFolderPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good time to move to the ContractTestUtils assertions assertPathExists/assertPathDoesNotExist as they provide meaningful messages/diagnostics. I really don't like assertTrue/assertFalse without messages, as they make debugging test failures much harder than they need to be
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
TEST RESULTS HNS Account Location: East US 2
Existing JIRAs to track failures: ReadWriteandSeek, testDistCpWithIterator, testAbfsStreamOps, ITestAzureBlobFileSystemLease |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with the final set of changes.
While looking at it, I can see that some of the lines you've changed have existing bugs where they don't close the output streams.
Given you are editing these lines, now would be a good time to fix. But: it would be changing more of the code.
Thoughts?
assertPathDoesNotExist(fs, | ||
String.format("File with name %s should not exist", createFilePath), | ||
createFilePath); | ||
assertTrue(String.format("File with name %s should exist", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why switch from AssertPathExists?
If you want to go to the simpler true/false, move to AssertJ whose assert strings "describedAs()" as string formats only evaluated to assert failue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test verifies number of fs.exists() method calls based on its use in the assertions
assertTrue(inputStream.read() != 0); | ||
} | ||
|
||
// TEST WRITE FILE | ||
try { | ||
abfsStore.openFileForWrite(EXISTED_FILE_PATH, fs.getFsStatistics(), true, | ||
tracingContext); | ||
abfsStore.openFileForWrite(existedFilePath, fs.getFsStatistics(), true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this line (and it predates your patch): does the output stream need to be closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closed
assertTrue(fs.exists(EXISTED_FILE_PATH)); | ||
fs.mkdirs(EXISTED_FOLDER_PATH); | ||
assertTrue(fs.exists(EXISTED_FOLDER_PATH)); | ||
fs.create(existedFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be fs.create(existedFilePath).close()
. Not your change, but as the line is changed, time to fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -71,7 +70,7 @@ public void testMaxRequestsAndQueueCapacity() throws Exception { | |||
conf.set(ConfigurationKeys.AZURE_WRITE_MAX_REQUESTS_TO_QUEUE, | |||
"" + maxRequestsToQueue); | |||
final AzureBlobFileSystem fs = getFileSystem(conf); | |||
FSDataOutputStream out = fs.create(TEST_FILE_PATH); | |||
FSDataOutputStream out = fs.create(path(TEST_FILE_PATH)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be closed too in try-with-resources or try/finally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
🎊 +1 overall
This message was automatically generated. |
TEST RESULTS HNS Account Location: East US 2
Existing JIRAs to track failures: testDistCp, testAbfsStreamOps, Appendblob lease |
🎊 +1 overall
This message was automatically generated. |
merged into trunk. Can you cherrypick into branch-3.3 and retest there to make sure all is good. regarding the test failures, #3240 fixes the distcp issues. Please apply and verify that it works on your test setup. |
Contributed by Sumangala Patki (cherry picked from commit 10ba4cc)
Contributed by Sumangala Patki
Contributed by Sumangala Patki Change-Id: Ic8f34bf578069504f7a811a7729982b9c9f49729
Many of ABFS driver tests use common names for file paths (e.g., "/testfile"). This poses a risk of errors during parallel test runs when static variables (such as those for monitoring stats) affected by file paths are introduced.
Using unique test file names will avoid possible errors arising from shared resources during parallel runs.