File indexing completed on 2025-08-28 08:26:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #pragma once
0019
0020 #include <memory>
0021 #include <string>
0022 #include <utility>
0023
0024 #include <gtest/gtest.h>
0025
0026 #include "arrow/filesystem/s3fs.h"
0027 #include "arrow/status.h"
0028 #include "arrow/testing/gtest_util.h"
0029 #include "arrow/testing/util.h"
0030 #include "arrow/util/checked_cast.h"
0031 #include "arrow/util/macros.h"
0032
0033 namespace arrow {
0034 namespace fs {
0035
0036
0037
0038 class MinioTestServer {
0039 public:
0040 MinioTestServer();
0041 ~MinioTestServer();
0042
0043 Status Start(bool enable_tls = false);
0044
0045 Status Stop();
0046
0047 std::string connect_string() const;
0048
0049 std::string access_key() const;
0050
0051 std::string secret_key() const;
0052
0053 std::string ca_dir_path() const;
0054
0055 std::string ca_file_path() const;
0056
0057 std::string scheme() const;
0058
0059 private:
0060 Status GenerateCertificateFile();
0061 struct Impl;
0062 std::unique_ptr<Impl> impl_;
0063 };
0064
0065
0066
0067
0068 class MinioTestEnvironment : public ::testing::Environment {
0069 public:
0070 explicit MinioTestEnvironment(bool enable_tls = false);
0071 ~MinioTestEnvironment();
0072
0073 void SetUp() override;
0074
0075 Result<std::shared_ptr<MinioTestServer>> GetOneServer();
0076
0077 protected:
0078 struct Impl;
0079 std::unique_ptr<Impl> impl_;
0080 };
0081
0082
0083
0084
0085 class S3Environment : public ::testing::Environment {
0086 public:
0087
0088
0089
0090
0091
0092 S3Environment() : ec2_metadata_disabled_guard_("AWS_EC2_METADATA_DISABLED", "true") {}
0093
0094 void SetUp() override {
0095
0096 S3GlobalOptions options;
0097 options.log_level = S3LogLevel::Fatal;
0098 ASSERT_OK(InitializeS3(options));
0099 }
0100
0101 void TearDown() override { ASSERT_OK(FinalizeS3()); }
0102
0103 private:
0104 EnvVarGuard ec2_metadata_disabled_guard_;
0105 };
0106
0107 }
0108 }