Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions cpp/src/arrow/filesystem/gcsfs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,32 @@ class GcsIntegrationTest : public ::testing::Test {
// Initialize a PRNG with a small amount of entropy.
generator_ = std::mt19937_64(std::random_device()());
port_ = std::to_string(GetListenPort());
auto exe_path = bp::search_path("python3");
ASSERT_THAT(exe_path, Not(IsEmpty()));

server_process_ = bp::child(boost::this_process::environment(), exe_path, "-m",
"testbench", "--port", port_, group_);
std::vector<std::string> names{"python3", "python"};
// If the build script or application developer provides a value in the PYTHON
// environment variable, then just use that.
if (const auto* env = std::getenv("PYTHON")) {
names = {env};
}
auto error = std::string(
"Cloud not start GCS emulator."
" Used the following list of python interpreter names:");
for (const auto& interpreter : names) {
auto exe_path = bp::search_path(interpreter);
error += " " + interpreter;
if (exe_path.empty()) {
error += " (exe not found)";
continue;
}

server_process_ = bp::child(boost::this_process::environment(), exe_path, "-m",
"testbench", "--port", port_, group_);
if (server_process_.valid() && server_process_.running()) break;
error += " (failed to start)";
server_process_.terminate();
server_process_.wait();
}
ASSERT_TRUE(server_process_.valid()) << error;
ASSERT_TRUE(server_process_.running()) << error;

// Create a bucket and a small file in the testbench. This makes it easier to
// bootstrap GcsFileSystem and its tests.
Expand Down