From 0aabd24d246fcaea9fb33772f091b6ffa1ced885 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Wed, 13 Oct 2021 17:07:36 +0000 Subject: [PATCH] ARROW-14311: [C++] Make GCS FileSystem tests faster Avoid using the default credentials for the unit test. In some environments these can be very slow to initialize, as they test several different potential sources of credentials, some including HTTP requests. --- cpp/src/arrow/filesystem/gcsfs.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cpp/src/arrow/filesystem/gcsfs.cc b/cpp/src/arrow/filesystem/gcsfs.cc index 898e54cf593bd..beb6c0a89ef90 100644 --- a/cpp/src/arrow/filesystem/gcsfs.cc +++ b/cpp/src/arrow/filesystem/gcsfs.cc @@ -106,16 +106,16 @@ class GcsInputStream : public arrow::io::InputStream { google::cloud::Options AsGoogleCloudOptions(const GcsOptions& o) { auto options = google::cloud::Options{}; + std::string scheme = o.scheme; + if (scheme.empty()) scheme = "https"; + if (scheme == "https") { + options.set( + google::cloud::MakeGoogleDefaultCredentials()); + } else { + options.set( + google::cloud::MakeInsecureCredentials()); + } if (!o.endpoint_override.empty()) { - std::string scheme = o.scheme; - if (scheme.empty()) scheme = "https"; - if (scheme == "https") { - options.set( - google::cloud::MakeGoogleDefaultCredentials()); - } else { - options.set( - google::cloud::MakeInsecureCredentials()); - } options.set(scheme + "://" + o.endpoint_override); } return options;