kou commented on code in PR #39840:
URL: https://github.com/apache/arrow/pull/39840#discussion_r1475431155


##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1382,25 @@ TEST_F(TestAzuriteFileSystem, 
DeleteDirContentsFailureNonexistent) {
   this->TestDeleteDirContentsFailureNonexistent();
 }
 
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccess) {
+  CreateFile(fs(), "abc", "data");
+  arrow::fs::AssertFileInfo(fs(), "abc", FileType::File);
+  ASSERT_OK(fs()->DeleteFile("abc"));
+  arrow::fs::AssertFileInfo(fs(), "abc", FileType::NotFound);
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileFailureNonexistent) {
+  arrow::fs::AssertFileInfo(fs(), "abc", FileType::NotFound);
+  ASSERT_RAISES(IOError, fs()->DeleteFile("abc"));
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileFailureContainer) {
+  const auto container_name = PreexistingData::RandomContainerName(rng_);
+  ASSERT_OK(fs()->CreateDir(container_name));
+  arrow::fs::AssertFileInfo(fs(), container_name, FileType::Directory);
+  ASSERT_RAISES(IOError, fs()->DeleteFile(container_name));
+}
+

Review Comment:
   Could you add a test for deleting a directory marker something like the 
following?
   
   ```cpp
   TEST_F(TestAzuriteFileSystem, DeleteFileFailureDirectory) {
     const auto directory_name = 
ConcatAbstractPath(PreexistingData::RandomContainerName(rng_), "directory");
     ASSERT_OK(fs()->CreateDir(directory_name));
     arrow::fs::AssertFileInfo(fs(), directory_name, FileType::Directory);
     ASSERT_RAISES(IOError, fs()->DeleteFile(directory_name));
   }
   ```



##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1382,25 @@ TEST_F(TestAzuriteFileSystem, 
DeleteDirContentsFailureNonexistent) {
   this->TestDeleteDirContentsFailureNonexistent();
 }
 
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccess) {
+  CreateFile(fs(), "abc", "data");
+  arrow::fs::AssertFileInfo(fs(), "abc", FileType::File);
+  ASSERT_OK(fs()->DeleteFile("abc"));
+  arrow::fs::AssertFileInfo(fs(), "abc", FileType::NotFound);
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileFailureNonexistent) {
+  arrow::fs::AssertFileInfo(fs(), "abc", FileType::NotFound);
+  ASSERT_RAISES(IOError, fs()->DeleteFile("abc"));

Review Comment:
   How about simplifying this?
   
   ```suggestion
     ASSERT_RAISES(IOError, fs()->DeleteFile("nonexistent"));
   ```



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

Reply via email to