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

Method SetUp

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

Source from the content-addressed store, hash-verified

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

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