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


##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1386,29 @@ TEST_F(TestAzuriteFileSystem, 
DeleteDirContentsFailureNonexistent) {
   this->TestDeleteDirContentsFailureNonexistent();
 }
 
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessHaveFile) {
+  const auto blob_name = PreexistingData::RandomBlobName(rng_);
+  ASSERT_OK(CreateFile(fs(), blob_name, "abc"));
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::File);
+  ASSERT_OK(fs()->DeleteFile(blob_name));
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::NotFound);
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessNonexistent) {
+  const auto blob_name = PreexistingData::RandomBlobName(rng_);
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::NotFound);
+  ASSERT_RAISES(IOError, fs()->DeleteFile(blob_name));
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessNotAFile) {

Review Comment:
   ```suggestion
   TEST_F(TestAzuriteFileSystem, DeleteFileFailureContainer) {
   ```



##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1386,29 @@ TEST_F(TestAzuriteFileSystem, 
DeleteDirContentsFailureNonexistent) {
   this->TestDeleteDirContentsFailureNonexistent();
 }
 
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessHaveFile) {
+  const auto blob_name = PreexistingData::RandomBlobName(rng_);
+  ASSERT_OK(CreateFile(fs(), blob_name, "abc"));
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::File);
+  ASSERT_OK(fs()->DeleteFile(blob_name));
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::NotFound);
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessNonexistent) {
+  const auto blob_name = PreexistingData::RandomBlobName(rng_);
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::NotFound);
+  ASSERT_RAISES(IOError, fs()->DeleteFile(blob_name));
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessNotAFile) {
+  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));
+  ASSERT_OK(fs()->DeleteDir(container_name));
+  arrow::fs::AssertFileInfo(fs(), container_name, FileType::NotFound);

Review Comment:
   We can remove them because our `TearDown()` function deletes all containers.
   
   ```suggestion
     ASSERT_OK(fs()->DeleteDir(container_name));
     arrow::fs::AssertFileInfo(fs(), container_name, FileType::NotFound);
   ```



##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1386,29 @@ TEST_F(TestAzuriteFileSystem, 
DeleteDirContentsFailureNonexistent) {
   this->TestDeleteDirContentsFailureNonexistent();
 }
 
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessHaveFile) {
+  const auto blob_name = PreexistingData::RandomBlobName(rng_);
+  ASSERT_OK(CreateFile(fs(), blob_name, "abc"));
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::File);
+  ASSERT_OK(fs()->DeleteFile(blob_name));
+  arrow::fs::AssertFileInfo(fs(), blob_name, FileType::NotFound);
+}
+
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessNonexistent) {

Review Comment:
   ```suggestion
   TEST_F(TestAzuriteFileSystem, DeleteFileFailureNonexistent) {
   ```



##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -1382,6 +1386,29 @@ TEST_F(TestAzuriteFileSystem, 
DeleteDirContentsFailureNonexistent) {
   this->TestDeleteDirContentsFailureNonexistent();
 }
 
+TEST_F(TestAzuriteFileSystem, DeleteFileSuccessHaveFile) {

Review Comment:
   Could you simplify test name?
   
   ```suggestion
   TEST_F(TestAzuriteFileSystem, DeleteFileSuccess) {
   ```



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