Repository: apache/arrow
File: cpp/src/arrow/filesystem/azurefs_test.cc (C++)

Code before:
  //   #6 Azure::Storage::Blobs::BlockBlobClient::CommitBlockList
  //   #7 arrow::fs::(anonymous namespace)::CommitBlockList
  //   #8 arrow::fs::(anonymous namespace)::ObjectAppendStream::FlushAsync()::'lambda'
  // clang-format on
  //
  // TODO perhaps remove this skip once we can rely on
  // https://github.com/Azure/azure-sdk-for-cpp/pull/5767
  //
  // Also note that ClickHouse has a workaround for a similar issue:
  // https://github.com/ClickHouse/ClickHouse/pull/45796
  bool have_false_positive_memory_leak_with_async_close() const override { return true; }

  BaseAzureEnv* env_;
  std::shared_ptr<AzureFileSystem> azure_fs_;
  std::shared_ptr<FileSystem> fs_;

 private:
  std::string container_name_;
};

class TestAzuriteGeneric : public TestGeneric {
 public:
  void SetUp() override {
    auto env_result = AzuriteEnv::GetInstance();
    if (!env_result.ok()) {
      GTEST_SKIP() << "Failed to setup: " << env_result.status().ToString();
    }
    SetUpInternal(*env_result);
  }

 protected:
  // Azurite doesn't block writing files over directories.
  bool allow_write_file_over_dir() const override { return true; }
  // Azurite doesn't support moving directories.
  bool allow_move_dir() const override { return false; }
  // Azurite doesn't support moving files.
  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();
  }
};

class TestAzureFlatNSGeneric : public TestGeneric {
 public:
  void SetUp() override {
    auto env_result = AzureFlatNSEnv::GetInstance();
    if (env_result.status().IsCancelled()) {
      GTEST_SKIP() << env_result.status().message();

Review comment (suggestion):
couldn't this makes us miss tests being skipped due to issues with our environment? We could potentially stop testing Azure and not realize

Code after:
  //   #6 Azure::Storage::Blobs::BlockBlobClient::CommitBlockList
  //   #7 arrow::fs::(anonymous namespace)::CommitBlockList
  //   #8 arrow::fs::(anonymous namespace)::ObjectAppendStream::FlushAsync()::'lambda'
  // clang-format on
  //
  // TODO perhaps remove this skip once we can rely on
  // https://github.com/Azure/azure-sdk-for-cpp/pull/5767
  //
  // Also note that ClickHouse has a workaround for a similar issue:
  // https://github.com/ClickHouse/ClickHouse/pull/45796
  bool have_false_positive_memory_leak_with_async_close() const override { return true; }

  BaseAzureEnv* env_;
  std::shared_ptr<AzureFileSystem> azure_fs_;
  std::shared_ptr<FileSystem> fs_;

 private:
  std::string container_name_;
};

class TestAzuriteGeneric : public TestGeneric {
 public:
  void SetUp() override {
    ASSERT_OK_AND_ASSIGN(auto env, AzuriteEnv::GetInstance());
    SetUpInternal(env);
  }

 protected:
  // Azurite doesn't block writing files over directories.
  bool allow_write_file_over_dir() const override { return true; }
  // Azurite doesn't support moving directories.
  bool allow_move_dir() const override { return false; }
  // Azurite doesn't support moving files.
  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();
  }
};

class TestAzureFlatNSGeneric : public TestGeneric {
 public:
  void SetUp() override {
    auto env_result = AzureFlatNSEnv::GetInstance();
    if (env_result.status().IsCancelled()) {
      GTEST_SKIP() << env_result.status().message();
    }
    ASSERT_OK_AND_ASSIGN(auto env, env_result);
    SetUpInternal(env);