bhattmanish98 commented on code in PR #7364:
URL: https://github.com/apache/hadoop/pull/7364#discussion_r1958165392


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemRename.java:
##########
@@ -1641,4 +1648,112 @@ public void 
testRenameSrcDirDeleteEmitDeletionCountInClientRequestId()
             Mockito.any(TracingContext.class));
     fs.rename(new Path(dirPathStr), new Path("/dst/"));
   }
+
+  /**
+   * Test to verify the idempotency of the `rename` operation in Azure Blob 
File System when retrying
+   * after a failure. The test simulates a "path not found" error (HTTP 404) 
on the first attempt,
+   * checks that the operation correctly retries using the appropriate 
transaction ID,
+   * and ensures that the source file is renamed to the destination path once 
successful.
+   *
+   * @throws Exception if an error occurs during the file system operations or 
mocking
+   */
+  @Test
+  public void renamePathRetryIdempotency() throws Exception {
+    Configuration configuration = new Configuration(getRawConfiguration());
+    configuration.set(FS_AZURE_ENABLE_CLIENT_TRANSACTION_ID, "true");
+    try (AzureBlobFileSystem fs = getFileSystem()) {
+      assumeRecoveryThroughClientTransactionID(fs, false);
+      AbfsClient abfsClient = Mockito.spy(fs.getAbfsClient());
+      fs.getAbfsStore().setClient(abfsClient);
+      Path sourceDir = path("/testSrc");
+      assertMkdirs(fs, sourceDir);
+      String filename = "file1";
+      Path sourceFilePath = new Path(sourceDir, filename);
+      touch(sourceFilePath);

Review Comment:
   It is inside try block only.



##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemRename.java:
##########
@@ -1641,4 +1648,112 @@ public void 
testRenameSrcDirDeleteEmitDeletionCountInClientRequestId()
             Mockito.any(TracingContext.class));
     fs.rename(new Path(dirPathStr), new Path("/dst/"));
   }
+
+  /**
+   * Test to verify the idempotency of the `rename` operation in Azure Blob 
File System when retrying
+   * after a failure. The test simulates a "path not found" error (HTTP 404) 
on the first attempt,
+   * checks that the operation correctly retries using the appropriate 
transaction ID,
+   * and ensures that the source file is renamed to the destination path once 
successful.
+   *
+   * @throws Exception if an error occurs during the file system operations or 
mocking
+   */
+  @Test
+  public void renamePathRetryIdempotency() throws Exception {
+    Configuration configuration = new Configuration(getRawConfiguration());
+    configuration.set(FS_AZURE_ENABLE_CLIENT_TRANSACTION_ID, "true");
+    try (AzureBlobFileSystem fs = getFileSystem()) {
+      assumeRecoveryThroughClientTransactionID(fs, false);
+      AbfsClient abfsClient = Mockito.spy(fs.getAbfsClient());
+      fs.getAbfsStore().setClient(abfsClient);
+      Path sourceDir = path("/testSrc");
+      assertMkdirs(fs, sourceDir);
+      String filename = "file1";
+      Path sourceFilePath = new Path(sourceDir, filename);
+      touch(sourceFilePath);

Review Comment:
   It is already inside try block.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to