felipecrv commented on code in PR #40075:
URL: https://github.com/apache/arrow/pull/40075#discussion_r1491399770


##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -889,6 +889,117 @@ class TestAzureFileSystem : public ::testing::Test {
     ASSERT_RAISES(IOError, fs()->DeleteDirContents(directory_path, false));
   }
 
+  void TestDeleteFileAtRoot() {
+    ASSERT_RAISES(Invalid, fs()->DeleteFile("file0"));
+    ASSERT_RAISES(Invalid, fs()->DeleteFile("file1/"));
+    const auto container_name = PreexistingData::RandomContainerName(rng_);
+    if (WithHierarchicalNamespace()) {
+      ARROW_UNUSED(CreateFilesystem(container_name));
+    } else {
+      ARROW_UNUSED(CreateContainer(container_name));
+    }
+    arrow::fs::AssertFileInfo(fs(), container_name, FileType::Directory);
+    ASSERT_RAISES(IOError, fs()->DeleteFile(container_name));
+    ASSERT_RAISES(IOError, fs()->DeleteFile(container_name + "/"));
+  }
+
+  void TestDeleteFileAtContainerRoot() {
+    auto data = SetUpPreexistingData();
+
+    EXPECT_RAISES_WITH_MESSAGE_THAT(
+        IOError,
+        ::testing::HasSubstr("Path does not exist '" + 
data.Path("nonexistent-file") +
+                             "'"),
+        fs()->DeleteFile(data.Path("nonexistent-file")));
+    EXPECT_RAISES_WITH_MESSAGE_THAT(
+        IOError,
+        ::testing::HasSubstr("Not a regular file: '" + 
data.Path("nonexistent-file/") +
+                             "'"),
+        fs()->DeleteFile(data.Path("nonexistent-file/")));

Review Comment:
   This is supposed to be just like the test above, but with a slash in the 
path. I will replace "file" with "path" so I can keep them the same.



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