snvijaya commented on a change in pull request #2021:
URL: https://github.com/apache/hadoop/pull/2021#discussion_r425632886



##########
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemDelete.java
##########
@@ -130,4 +148,50 @@ public Void call() throws Exception {
     assertPathDoesNotExist(fs, "deleted", dir);
 
   }
+
+  @Test
+  public void testDeleteIdempotency() throws Exception {
+    org.junit.Assume.assumeTrue(DEFAULT_DELETE_CONSIDERED_IDEMPOTENT);
+    // Config to reduce the retry and maxBackoff time for test run
+    AbfsConfiguration abfsConfig = getConfiguration();
+    abfsConfig.setMaxIoRetries(REDUCED_RETRY_COUNT);
+    
abfsConfig.setMaxBackoffIntervalMilliseconds(REDUCED_MAX_BACKOFF_INTERVALS_MS);
+
+    final AzureBlobFileSystem fs = getFileSystem();
+    AbfsClient abfsClient = fs.getAbfsStore().getClient();
+    AbfsPerfTracker tracker = new AbfsPerfTracker("test",
+        this.getAccountName(),
+        abfsConfig);
+
+    // Create test AbfsClient
+    AbfsClient testClient = new AbfsClient(
+        abfsClient.getBaseUrl(),
+        new SharedKeyCredentials(abfsConfig.getAccountName().substring(0,
+            abfsConfig.getAccountName().indexOf(DOT)),
+            abfsConfig.getStorageAccountKey()),
+        abfsConfig,
+        new ExponentialRetryPolicy(REDUCED_RETRY_COUNT),
+        abfsConfig.getTokenProvider(),
+        tracker);
+
+    // Mock instance of AbfsRestOperation
+    AbfsRestOperation op = mock(AbfsRestOperation.class);
+    // Set retryCount to non-zero
+    when(op.isARetriedRequest()).thenReturn(true);
+
+    // Mock instance of Http Operation response. This will return HTTP:Not 
Found
+    AbfsHttpOperation http404Op = mock(AbfsHttpOperation.class);
+    when(http404Op.getStatusCode()).thenReturn(HTTP_NOT_FOUND);
+
+    // Mock delete response to 404
+    when(op.getResult()).thenReturn(http404Op);
+
+    assertEquals(

Review comment:
       Fixed.




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

Reply via email to