diff --git a/cpp/src/arrow/filesystem/s3_test_util.cc b/cpp/src/arrow/filesystem/s3_test_util.cc index 15b124f321a0b..99a4c42afc26c 100644 --- a/cpp/src/arrow/filesystem/s3_test_util.cc +++ b/cpp/src/arrow/filesystem/s3_test_util.cc @@ -50,7 +50,7 @@ const char* kEnvConnectString = "ARROW_TEST_S3_CONNECT_STRING"; const char* kEnvAccessKey = "ARROW_TEST_S3_ACCESS_KEY"; const char* kEnvSecretKey = "ARROW_TEST_S3_SECRET_KEY"; -std::string GenerateConnectString() { return GetListenAddress(); } +std::string GenerateConnectString() { return GetListenAddress("localhost"); } } // namespace diff --git a/cpp/src/arrow/testing/util.cc b/cpp/src/arrow/testing/util.cc index 7bef9f7d4756d..e5e53801df949 100644 --- a/cpp/src/arrow/testing/util.cc +++ b/cpp/src/arrow/testing/util.cc @@ -206,6 +206,12 @@ std::string GetListenAddress() { return ss.str(); } +std::string GetListenAddress(const std::string& host) { + std::stringstream ss; + ss << host << ":" << GetListenPort(); + return ss.str(); +} + const std::vector>& all_dictionary_index_types() { static std::vector> types = { int8(), uint8(), int16(), uint16(), int32(), uint32(), int64(), uint64()}; diff --git a/cpp/src/arrow/testing/util.h b/cpp/src/arrow/testing/util.h index b4b2785a36292..8cc28a8b073a4 100644 --- a/cpp/src/arrow/testing/util.h +++ b/cpp/src/arrow/testing/util.h @@ -128,6 +128,10 @@ ARROW_TESTING_EXPORT int GetListenPort(); // port conflicts. ARROW_TESTING_EXPORT std::string GetListenAddress(); +// Get a "host:port" to listen on. Compared to GetListenAddress(), this function would use +// the host passed in. +ARROW_TESTING_EXPORT std::string GetListenAddress(const std::string& host); + ARROW_TESTING_EXPORT const std::vector>& all_dictionary_index_types();