MCPcopy Create free account
hub / github.com/apache/arrow / SetUp

Method SetUp

cpp/src/arrow/filesystem/gcsfs_test.cc:138–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136class GcsIntegrationTest : public ::testing::Test {
137 protected:
138 void SetUp() override {
139 ASSERT_THAT(Testbench(), NotNull());
140 ASSERT_EQ(Testbench()->error(), "");
141 ASSERT_TRUE(Testbench()->running());
142
143 // Initialize a PRNG with a small amount of entropy.
144 generator_ = std::mt19937_64(std::random_device()());
145 bucket_name_ = RandomChars(32);
146
147 // Create a bucket and a small file in the testbench. This makes it easier to
148 // bootstrap GcsFileSystem and its tests.
149 auto client = gcs::Client(
150 google::cloud::Options{}
151 .set<gcs::RestEndpointOption>("http://127.0.0.1:" + Testbench()->port())
152 .set<gc::UnifiedCredentialsOption>(gc::MakeInsecureCredentials())
153 .set<gcs::TransferStallTimeoutOption>(std::chrono::seconds(5))
154 .set<gcs::RetryPolicyOption>(
155 gcs::LimitedTimeRetryPolicy(std::chrono::seconds(45)).clone()));
156
157 google::cloud::StatusOr<gcs::BucketMetadata> bucket = client.CreateBucketForProject(
158 PreexistingBucketName(), "ignored-by-testbench", gcs::BucketMetadata{});
159 ASSERT_TRUE(bucket.ok()) << "Failed to create bucket <" << PreexistingBucketName()
160 << ">, status=" << bucket.status();
161
162 google::cloud::StatusOr<gcs::ObjectMetadata> object = client.InsertObject(
163 PreexistingBucketName(), PreexistingObjectName(), kLoremIpsum);
164 ASSERT_TRUE(object.ok()) << "Failed to create object <" << PreexistingObjectName()
165 << ">, status=" << object.status();
166 }
167
168 std::string PreexistingBucketName() const { return bucket_name_; }
169

Callers

nothing calls this directly

Calls 7

TestbenchFunction · 0.85
runningMethod · 0.80
cloneMethod · 0.80
ClientClass · 0.50
portMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected