From 20bf5dfcd4bd72c3f416bac020647f73dc417d67 Mon Sep 17 00:00:00 2001 From: Hang Zheng Date: Thu, 17 Oct 2024 23:00:33 -0400 Subject: [PATCH] set the correct address for the minio start args --- cpp/src/arrow/filesystem/s3_test_util.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cpp/src/arrow/filesystem/s3_test_util.cc b/cpp/src/arrow/filesystem/s3_test_util.cc index 191185300de34..14f9775afecc0 100644 --- a/cpp/src/arrow/filesystem/s3_test_util.cc +++ b/cpp/src/arrow/filesystem/s3_test_util.cc @@ -136,20 +136,24 @@ Status MinioTestServer::Start(bool enable_tls_if_supported) { impl_->server_process_->SetEnv("MINIO_BROWSER", "off"); impl_->connect_string_ = GenerateConnectString(); // NOTE: --quiet makes startup faster by suppressing remote version check - std::vector minio_args({"server", "--quiet", "--compat", "--address", - impl_->connect_string_, - impl_->temp_dir_->path().ToString()}); + std::vector minio_args({"server", "--quiet", "--compat"}); if (enable_tls_if_supported) { #ifdef MINIO_SERVER_WITH_TLS ARROW_RETURN_NOT_OK(GenerateCertificateFile()); - minio_args.push_back("--certs-dir"); - minio_args.push_back(ca_dir_path()); + minio_args.emplace_back("--certs-dir"); + minio_args.emplace_back(ca_dir_path()); impl_->scheme_ = "https"; impl_->connect_string_ = GetListenAddress("localhost"); // for TLS enabled case, we need to use localhost // which is the fixed hostname in the certificate #endif // MINIO_SERVER_WITH_TLS } + minio_args.emplace_back("--address"); + minio_args.emplace_back( + impl_->connect_string_); // the connect_string_ differs for the http and https, + // https is fixed localhost while http is the dynamic ip + // in range 127.0.0.1/8 + minio_args.emplace_back(impl_->temp_dir_->path().ToString()); ARROW_RETURN_NOT_OK(impl_->server_process_->SetExecutable(kMinioExecutableName)); impl_->server_process_->SetArgs(minio_args);