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


##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1382,32 @@ 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);

Review Comment:
   This test failed: 
   
   
https://github.com/apache/arrow/actions/runs/7761414467/job/21171628885?pr=39840#step:6:3519
   
   ```text
   [ RUN      ] TestAzuriteFileSystem.DeleteFileSuccess
   /arrow/cpp/src/arrow/filesystem/test_util.cc:120: Failure
   Failed
   '_error_or_value24.status()' failed with IOError: Not a regular file: 'abc'
   /arrow/cpp/src/arrow/filesystem/test_util.cc:143: Failure
   Expected equality of these values:
     info.type()
       Which is: FileType::NotFound
     type
       Which is: FileType::File
   For path 'abc'
   /arrow/cpp/src/arrow/filesystem/azurefs_test.cc:1388: Failure
   Failed
   'fs()->DeleteFile("abc")' failed with IOError: Not a regular file: 'abc'
   ```
   
   Could you run tests on your local environment? If you're on Linux, the 
following will work (you also need to install Azurite by `sudo npm install -g 
azurite`):
   
   ```bash
   cd CPP_BUILD_DIRECTORY
   cmake --build .
   LD_LIBRARY_PATH=$PWD/debug debug/arrow-azurefs-test
   ```
   
   (Or you can use Docker instead.)
   
   I think that we need to do something like the following:
   
   ```cpp
   const auto container_name = PreexistingData::RandomContainerName(rng_);
   ASSERT_OK(fs()->CreateDir(container_name));
   const auto file_name = ConcatAbstractPath(container_name, "abc");
   CreateFile(fs(), file_name, "data");
   arrow::fs::AssertFileInfo(fs(), file_name, FileType::File);
   ASSERT_OK(fs()->DeleteFile(file_name));
   arrow::fs::AssertFileInfo(fs(), file_name, FileType::NotFound);
   ```



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