From 1b7178d47f4c117a6dba4c8da1733bba31287127 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Wed, 27 Oct 2021 08:33:40 +0900 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. Closes #11406 from coryan/ARROW-14311-GCS-filesystem-now-uses-insecure-credentials-for-http Authored-by: Carlos O'Ryan Signed-off-by: Sutou Kouhei --- 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;