bilaharith commented on a change in pull request #2021:
URL: https://github.com/apache/hadoop/pull/2021#discussion_r425343840
##########
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. I see common code as (1. Creating FS instance, 2. Creating testClient
instance, 3. Creating mock AbfsRestOperation instance, 4. Common assertion).
This is clubbed with the non common codes (1. Creating http400Op instance for
one particular test case, 2. Creating http404Op instance for another
particular test case)
Shall we move the common instances that are required to a separate private
methods and call those methods in each test case? That would help improve
readability and solved the problem of code duplication.
2. I think we should relook and address the issues with the old PRs if those
are recent, where resusable code is duplicated. Could you please create a
workitem for this.
----------------------------------------------------------------
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]