MCPcopy Create free account
hub / github.com/apache/arrow / Start

Method Start

cpp/src/arrow/filesystem/s3_test_util.cc:112–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112Status MinioTestServer::Start(bool enable_tls) {
113 const char* connect_str = std::getenv(kEnvConnectString);
114 const char* access_key = std::getenv(kEnvAccessKey);
115 const char* secret_key = std::getenv(kEnvSecretKey);
116 if (connect_str && access_key && secret_key) {
117 // Use external instance
118 impl_->connect_string_ = connect_str;
119 impl_->access_key_ = access_key;
120 impl_->secret_key_ = secret_key;
121 return Status::OK();
122 }
123
124 ARROW_ASSIGN_OR_RAISE(impl_->temp_dir_, TemporaryDir::Make("s3fs-test-"));
125
126 impl_->server_process_ = std::make_unique<util::Process>();
127 impl_->server_process_->SetEnv("MINIO_ACCESS_KEY", kMinioAccessKey);
128 impl_->server_process_->SetEnv("MINIO_SECRET_KEY", kMinioSecretKey);
129 // Disable the embedded console (one less listening address to care about)
130 impl_->server_process_->SetEnv("MINIO_BROWSER", "off");
131 // NOTE: --quiet makes startup faster by suppressing remote version check
132 std::vector<std::string> minio_args({"server", "--quiet", "--compat"});
133 if (enable_tls) {
134 ARROW_RETURN_NOT_OK(GenerateCertificateFile());
135 minio_args.emplace_back("--certs-dir");
136 minio_args.emplace_back(ca_dir_path());
137 impl_->scheme_ = "https";
138 // With TLS enabled, we need the connection hostname to match the certificate's
139 // subject name. This also constrains the actual listening IP address.
140 impl_->connect_string_ = GetListenAddress("localhost");
141 } else {
142 // Without TLS enabled, we want to minimize the likelihood of address collisions
143 // by varying the listening IP address (note that most tests don't enable TLS).
144 impl_->connect_string_ = GetListenAddress();
145 }
146 minio_args.emplace_back("--address");
147 minio_args.emplace_back(impl_->connect_string_);
148 minio_args.emplace_back(impl_->temp_dir_->path().ToString());
149
150 ARROW_RETURN_NOT_OK(impl_->server_process_->SetExecutable(kMinioExecutableName));
151 impl_->server_process_->SetArgs(minio_args);
152 ARROW_RETURN_NOT_OK(impl_->server_process_->Execute());
153 return Status::OK();
154}
155
156Status MinioTestServer::Stop() {
157 impl_->server_process_ = nullptr;

Callers 3

LaunchOneServerMethod · 0.45
SetUpMethod · 0.45
SetUpMethod · 0.45

Calls 11

GetListenAddressFunction · 0.85
emplace_backMethod · 0.80
OKFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
MakeFunction · 0.50
SetEnvMethod · 0.45
ToStringMethod · 0.45
pathMethod · 0.45
SetExecutableMethod · 0.45
SetArgsMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected