snvijaya commented on a change in pull request #2021:
URL: https://github.com/apache/hadoop/pull/2021#discussion_r425627577
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemRename.java
##########
@@ -149,4 +166,135 @@ public void testPosixRenameDirectory() throws Exception {
assertTrue(fs.exists(new Path("testDir2/test4/test3")));
assertFalse(fs.exists(new Path("testDir2/test1/test2/test3")));
}
+
+ @Test
+ public void testRenameRetryFailureAsHTTP400() throws Exception {
+ // Rename failed as Bad Request
+ // RenameIdempotencyCheck should throw back the rename failure Op
+ testRenameTimeout(HTTP_BAD_REQUEST, HTTP_BAD_REQUEST, false);
+ }
+
+ @Test
+ public void testRenameRetryFailureAsHTTP404() throws Exception {
+ // Rename failed as FileNotFound and the destination LMT is
+ // within TimespanForIdentifyingRecentOperationThroughLMT
+ testRenameTimeout(HTTP_NOT_FOUND, HTTP_OK, false);
+ }
+
+ @Test
+ public void testRenameRetryFailureWithDestOldLMT() throws Exception {
+ // Rename failed as FileNotFound and the destination LMT is
+ // older than TimespanForIdentifyingRecentOperationThroughLMT
+ testRenameTimeout(HTTP_NOT_FOUND, HTTP_NOT_FOUND, true);
+ }
+
+ private void testRenameTimeout(
Review comment:
1. Creating a method, passing over all indiividual mock instances
created back to test method will actually render code more unreadable. Will
leave this comment open if any other reviewer feels the code is unreadable too.
2. For issues that have come across for my code changes, i have made
modifications with the respective PRs. Should definitely keep a look out for
any that come across.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]