[ https://issues.apache.org/jira/browse/HADOOP-19446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17933805#comment-17933805 ]
ASF GitHub Bot commented on HADOOP-19446: ----------------------------------------- anmolanmol1234 commented on code in PR #7376: URL: https://github.com/apache/hadoop/pull/7376#discussion_r1987005182 ########## hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemDelete.java: ########## @@ -344,6 +363,114 @@ public void deleteBlobDirParallelThreadToDeleteOnDifferentTracingContext() fs.close(); } + /** + * Test the deletion of file in an implicit directory. + * + * @throws Exception if an error occurs during the test execution + */ + @Test + public void testDeleteFileInImplicitDir() throws Exception { + AzureBlobFileSystem fs = getFileSystem(); + assumeBlobServiceType(); + + Path file1 = new Path("/testDir/dir1/file1"); + Path file2 = new Path("/testDir/dir1/file2"); + Path implicitDir = file1.getParent(); + + createAzCopyFile(file1); + createAzCopyFile(file2); + + // Deletion of file with different recursion values + fs.delete(file1, false); + fs.delete(file2, true); + + Assertions.assertThat(fs.exists(implicitDir)) + .describedAs("The directory should exist.") + .isTrue(); + Assertions.assertThat(fs.exists(file1)) + .describedAs("Deleted file should not be present.").isFalse(); + Assertions.assertThat(fs.exists(file2)) + .describedAs("Deleted file should not be present.").isFalse(); + } + + /** + * Test that the file status of an empty explicit dir + * should not exist after its deletion. + * + * @throws Exception if an error occurs during the test execution + */ + @Test + public void testDeleteEmptyExplicitDir() throws Exception { + AzureBlobFileSystem fs = getFileSystem(); + + Path p1 = new Path("/testDir1/"); + + fs.mkdirs(p1); + fs.delete(p1, false); + + Assertions.assertThat(fs.exists(p1)) + .describedAs("The deleted directory should not exist.") + .isFalse(); + } + + /** + * Test that deleting a non-empty explicit directory + * can only be done with the recursive flag set to true. + * + * @throws Exception if an error occurs during the test execution + */ + @Test + public void testDeleteNonEmptyExplicitDir() throws Exception { + AzureBlobFileSystem fs = getFileSystem(); + + Path p1 = new Path("/testDir1"); + Path p2 = new Path("/testDir2"); + + fs.create(new Path("/testDir1/f1.txt")); Review Comment: we should first call mkdirs on p1 and p2 for it to exist as explicit dir > ABFS: [FnsOverBlob][Tests] Add Tests For Negative Scenarios Identified for > Delete Operation > ------------------------------------------------------------------------------------------- > > Key: HADOOP-19446 > URL: https://issues.apache.org/jira/browse/HADOOP-19446 > Project: Hadoop Common > Issue Type: Sub-task > Components: fs/azure > Affects Versions: 3.4.1 > Reporter: Anuj Modi > Assignee: Manika Joshi > Priority: Major > Labels: pull-request-available > Attachments: Delete_TestScenarios.pdf > > > We have identified a few scenarios worth adding integration or mocked > behavior tests for while implementing FNS Support over Blob Endpoint. > Attached file shows the the scenarios identified for Ingress Related > operations on blob Endpoint (Create + Append + Flush filesystem calls) > This Jira tracks implementing these tests. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org