@@ -55,6 +55,17 @@ MinioTestEnvironment* GetMinioEnv() {
5555 return ::arrow::internal::checked_cast<MinioTestEnvironment*>(minio_env);
5656}
5757
58+ class S3ModuleTest : public ::testing::Test {
59+ protected:
60+ void SetUp () override {
61+ if (!GetMinioEnv ()->IsAvailable ()) {
62+ GTEST_SKIP () << " Minio executable not found, skipping tests" ;
63+ }
64+ ASSERT_OK_AND_ASSIGN (minio_, GetMinioEnv ()->GetOneServer ());
65+ }
66+ std::shared_ptr<MinioTestServer> minio_;
67+ };
68+
5869class RegistrationTestEnvironment : public ::testing::Environment {
5970 public:
6071 void SetUp () override {
@@ -68,12 +79,10 @@ class RegistrationTestEnvironment : public ::testing::Environment {
6879
6980auto * lib_env = ::testing::AddGlobalTestEnvironment(new RegistrationTestEnvironment);
7081
71- TEST (S3Test, FromUri) {
72- ASSERT_OK_AND_ASSIGN (auto minio, GetMinioEnv ()->GetOneServer ());
73-
82+ TEST_F (S3ModuleTest, FromUri) {
7483 std::string path;
75- ASSERT_OK_AND_ASSIGN (auto fs, FileSystemFromUri (" s3://" + minio ->access_key () + " :" +
76- minio ->secret_key () +
84+ ASSERT_OK_AND_ASSIGN (auto fs, FileSystemFromUri (" s3://" + minio_ ->access_key () + " :" +
85+ minio_ ->secret_key () +
7786 " @bucket/somedir/subdir/subfile" ,
7887 &path));
7988
@@ -83,12 +92,11 @@ TEST(S3Test, FromUri) {
8392 " &allow_bucket_creation=0&allow_bucket_deletion=0" );
8493}
8594
86- TEST (S3Test, FromUriAndOptionsCredentials) {
87- ASSERT_OK_AND_ASSIGN (auto minio, GetMinioEnv ()->GetOneServer ());
95+ TEST_F (S3ModuleTest, FromUriAndOptionsCredentials) {
8896 std::string path;
8997 FileSystemFactoryOptions options{
90- {" access_key" , std::string (minio ->access_key ())},
91- {" secret_key" , std::string (minio ->secret_key ())},
98+ {" access_key" , std::string (minio_ ->access_key ())},
99+ {" secret_key" , std::string (minio_ ->secret_key ())},
92100 };
93101 // Credentials supplied via options, NOT in the URI.
94102 ASSERT_OK_AND_ASSIGN (
@@ -111,11 +119,10 @@ class NoopRetryStrategy : public S3RetryStrategy {
111119};
112120} // namespace
113121
114- TEST (S3Test, FromUriAndOptionsRetryStrategy) {
115- ASSERT_OK_AND_ASSIGN (auto minio, GetMinioEnv ()->GetOneServer ());
122+ TEST_F (S3ModuleTest, FromUriAndOptionsRetryStrategy) {
116123 FileSystemFactoryOptions options{
117- {" access_key" , std::string (minio ->access_key ())},
118- {" secret_key" , std::string (minio ->secret_key ())},
124+ {" access_key" , std::string (minio_ ->access_key ())},
125+ {" secret_key" , std::string (minio_ ->secret_key ())},
119126 {" retry_strategy" ,
120127 std::shared_ptr<S3RetryStrategy>(std::make_shared<NoopRetryStrategy>())},
121128 };
0 commit comments