From 0ed6ee794f03619d35f22bfd55d459fad88aaf62 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 11 Apr 2024 08:59:58 +0900 Subject: [PATCH] GH-41034: [C++][FS][Azure] Adjust DeleteDir/DeleteDirContents/GetFileInfoSelector behaviors against Azure for generic filesystem tests (#41068) ### Rationale for this change They are failing: ```text [ FAILED ] TestAzureHierarchicalNSGeneric.DeleteDir [ FAILED ] TestAzureHierarchicalNSGeneric.DeleteDirContents [ FAILED ] TestAzureHierarchicalNSGeneric.GetFileInfoSelector ``` ### What changes are included in this PR? * `DeleteDir()`: Check not a directory case * `DeleteDirContents()`: Check not a directory case * `GetFileInfoSelector()`: * Add not a directory check for input * Add support for returning metadata for directory ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #41034 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/src/arrow/filesystem/azurefs_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/filesystem/azurefs_test.cc b/cpp/src/arrow/filesystem/azurefs_test.cc index 24031e313f798..ed09bfc2fadd7 100644 --- a/cpp/src/arrow/filesystem/azurefs_test.cc +++ b/cpp/src/arrow/filesystem/azurefs_test.cc @@ -392,7 +392,7 @@ class TestGeneric : public ::testing::Test, public GenericFileSystemTest { bool allow_move_dir() const override { return false; } bool allow_move_file() const override { return true; } bool allow_append_to_file() const override { return true; } - bool have_directory_mtimes() const override { return false; } + bool have_directory_mtimes() const override { return true; } bool have_flaky_directory_tree_deletion() const override { return false; } bool have_file_metadata() const override { return true; } // calloc() used in libxml2's xmlNewGlobalState() is detected as a @@ -429,6 +429,8 @@ class TestAzuriteGeneric : public TestGeneric { protected: // Azurite doesn't support moving files over containers. bool allow_move_file() const override { return false; } + // Azurite doesn't support directory mtime. + bool have_directory_mtimes() const override { return false; } // DeleteDir() doesn't work with Azurite on macOS bool have_flaky_directory_tree_deletion() const override { return env_->HasSubmitBatchBug(); @@ -449,6 +451,8 @@ class TestAzureFlatNSGeneric : public TestGeneric { protected: // Flat namespace account doesn't support moving files over containers. bool allow_move_file() const override { return false; } + // Flat namespace account doesn't support directory mtime. + bool have_directory_mtimes() const override { return false; } }; class TestAzureHierarchicalNSGeneric : public TestGeneric {