coryan commented on a change in pull request #11375:
URL: https://github.com/apache/arrow/pull/11375#discussion_r727280780



##########
File path: cpp/src/arrow/filesystem/gcsfs_test.cc
##########
@@ -59,6 +155,11 @@ TEST(GcsFileSystem, FileSystemCompare) {
   EXPECT_FALSE(a->Equals(*b));
 }
 
+TEST_F(GcsIntegrationTest, MakeBucket) {
+  auto fs = internal::MakeGcsFileSystemForTest(TestGcsOptions());
+  ASSERT_OK(fs->GetFileInfo(kPreexistingBucket));

Review comment:
       Done.

##########
File path: cpp/src/arrow/filesystem/gcsfs_test.cc
##########
@@ -19,21 +19,75 @@
 
 #include <gmock/gmock-matchers.h>
 #include <gmock/gmock-more-matchers.h>
+#include <google/cloud/credentials.h>
+#include <google/cloud/storage/client.h>
+#include <google/cloud/storage/options.h>
 #include <gtest/gtest.h>
 
+#include <boost/process.hpp>
 #include <string>
 
+#include "arrow/filesystem/gcsfs_internal.h"
 #include "arrow/testing/gtest_util.h"
 #include "arrow/testing/util.h"
 
 namespace arrow {
 namespace fs {
 namespace {
 
+namespace bp = boost::process;
+namespace gc = google::cloud;
+namespace gcs = google::cloud::storage;
+
+using ::testing::HasSubstr;
 using ::testing::IsEmpty;
 using ::testing::Not;
 using ::testing::NotNull;
 
+auto const* kPreexistingBucket = "test-bucket-name";
+
+class GcsIntegrationTest : public ::testing::Test {
+ public:
+  ~GcsIntegrationTest() override {
+    if (server_process_.valid()) {
+      // Brutal shutdown
+      server_process_.terminate();
+      server_process_.wait();
+    }
+  }
+
+ protected:
+  void SetUp() override {
+    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_);
+
+    // Create a bucket in the testbench so additional

Review comment:
       Fixed.

##########
File path: cpp/src/arrow/filesystem/gcsfs_internal.cc
##########
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "arrow/filesystem/gcsfs_internal.h"
+
+#include <google/cloud/storage/client.h>
+
+#include <sstream>
+
+namespace arrow {
+namespace fs {
+namespace internal {
+
+Status ToArrowStatus(const google::cloud::Status& s) {
+  std::ostringstream os;
+  os << "google::cloud::Status(" << s << ")";
+  switch (s.code()) {
+    case google::cloud::StatusCode::kOk:
+      break;
+    case google::cloud::StatusCode::kCancelled:
+      return Status::Cancelled(os.str());
+    case google::cloud::StatusCode::kUnknown:
+      return Status::UnknownError(os.str());
+    case google::cloud::StatusCode::kInvalidArgument:
+      return Status::Invalid(os.str());
+    case google::cloud::StatusCode::kDeadlineExceeded:
+    case google::cloud::StatusCode::kNotFound:
+      // TODO: it is unclear if a better mapping would be possible.

Review comment:
       Done.

##########
File path: cpp/src/arrow/filesystem/gcsfs.cc
##########
@@ -70,7 +131,9 @@ bool GcsFileSystem::Equals(const FileSystem& other) const {
 }
 
 Result<FileInfo> GcsFileSystem::GetFileInfo(const std::string& path) {
-  return Status::NotImplemented("The GCS FileSystem is not fully implemented");
+  auto p = GcsPath::FromString(path);
+  if (!p.ok()) return std::move(p).status();

Review comment:
       "simply" ... hmmm ... Done.

##########
File path: ci/docker/debian-10-cpp.dockerfile
##########
@@ -73,7 +74,10 @@ RUN apt-get update -y -q && \
 
 COPY ci/scripts/install_minio.sh \
      /arrow/ci/scripts/
+COPY ci/scripts/install_gcs_testbench.sh \
+     /arrow/ci/scripts/
 RUN /arrow/ci/scripts/install_minio.sh ${arch} linux latest /usr/local

Review comment:
       Fixed here and below.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to