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


##########
cpp/src/arrow/filesystem/azurefs_test.cc:
##########
@@ -194,49 +265,90 @@ TEST(AzureFileSystem, OptionsCompare) {
   EXPECT_TRUE(options.Equals(options));
 }
 
+auto const* kLoremIpsum = R"""(
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+culpa qui officia deserunt mollit anim id est laborum.
+)""";
+
 class AzureFileSystemTest : public ::testing::Test {
- public:
+ protected:
+  // Set in constructor
+  std::mt19937_64 generator_;
+
+  // Set in SetUp()
+  int64_t debug_log_start_ = 0;
+  bool set_up_succeeded_ = false;
+  AzureOptions options_;
+
   std::shared_ptr<FileSystem> fs_;
   std::unique_ptr<Blobs::BlobServiceClient> blob_service_client_;
   std::unique_ptr<DataLake::DataLakeServiceClient> datalake_service_client_;
-  AzureOptions options_;
-  std::mt19937_64 generator_;
+
+  // Set in SetUpPreexistingData()
   std::string container_name_;
-  bool suite_skipped_ = false;
 
+ public:
   AzureFileSystemTest() : generator_(std::random_device()()) {}
 
-  virtual Result<AzureOptions> MakeOptions() = 0;
+  virtual Result<BaseAzureEnv*> GetAzureEnv() const = 0;
+
+  static Result<AzureOptions> MakeOptions(BaseAzureEnv* env) {
+    AzureOptions options;
+    options.backend = env->backend();
+    ARROW_EXPECT_OK(
+        options.ConfigureAccountKeyCredential(env->account_name(), 
env->account_key()));
+    return options;
+  }
 
   void SetUp() override {
-    auto options = MakeOptions();
-    if (options.ok()) {
-      options_ = *options;
+    auto make_options = [this]() -> Result<AzureOptions> {
+      ARROW_ASSIGN_OR_RAISE(auto env, GetAzureEnv());
+      EXPECT_THAT(env, NotNull());
+      ARROW_ASSIGN_OR_RAISE(debug_log_start_, env->GetDebugLogSize());
+      return MakeOptions(env);
+    };
+    auto options_res = make_options();
+    if (!options_res.ok() && options_res.status().IsCancelled()) {
+      GTEST_SKIP() << options_res.status().message();
     } else {
-      suite_skipped_ = true;
-      GTEST_SKIP() << options.status().message();
+      EXPECT_OK_AND_ASSIGN(options_, std::move(options_res));
     }
-    // Stop-gap solution before GH-39119 is fixed.
-    container_name_ = "z" + RandomChars(31);
+
+    ASSERT_OK_AND_ASSIGN(fs_, AzureFileSystem::Make(options_));
     blob_service_client_ = options_.MakeBlobServiceClient();
     datalake_service_client_ = options_.MakeDataLakeServiceClient();
-    ASSERT_OK_AND_ASSIGN(fs_, AzureFileSystem::Make(options_));
-    auto container_client = CreateContainer(container_name_);
+    set_up_succeeded_ = true;
 
-    auto blob_client = 
container_client.GetBlockBlobClient(PreexistingObjectName());
-    blob_client.UploadFrom(reinterpret_cast<const uint8_t*>(kLoremIpsum),
-                           strlen(kLoremIpsum));
+    SetUpPreexistingData();

Review Comment:
   This gets moved in later commits.



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