@@ -36,7 +36,7 @@ namespace {
3636bool IsSet (std::chrono::system_clock::time_point tp) {
3737 return tp != std::chrono::system_clock::time_point{};
3838}
39- }
39+ } // namespace
4040
4141namespace google {
4242namespace cloud {
@@ -67,32 +67,6 @@ struct ObjectBasicCRUDIntegrationTest
6767 }
6868 return MakeIntegrationTestClient (std::move (options));
6969 }
70-
71- void SetUp () override {
72- // 1. Run the base class SetUp first. This initializes 'bucket_name_'
73- // from the environment variable.
74- ::google::cloud::storage::testing::ObjectIntegrationTest::SetUp ();
75-
76- // 2. Create a client to interact with the emulator/backend.
77- auto client = MakeIntegrationTestClient ();
78-
79- // 3. Check if the bucket exists.
80- auto metadata = client.GetBucketMetadata (bucket_name_);
81-
82- // 4. If it's missing (kNotFound), create it.
83- if (metadata.status ().code () == StatusCode::kNotFound ) {
84- // Use a default project ID if the env var isn't set (common in local emulators).
85- auto project_id =
86- google::cloud::internal::GetEnv (" GOOGLE_CLOUD_PROJECT" ).value_or (" test-project" );
87-
88- auto created = client.CreateBucketForProject (
89- bucket_name_, project_id, BucketMetadata ());
90- ASSERT_STATUS_OK (created) << " Failed to auto-create missing bucket: " << bucket_name_;
91- } else {
92- // If it exists (or failed for another reason), assert it is OK.
93- ASSERT_STATUS_OK (metadata) << " Failed to verify bucket existence: " << bucket_name_;
94- }
95- }
9670};
9771
9872// / @test Verify the Object CRUD (Create, Get, Update, Delete, List) operations.
@@ -179,11 +153,15 @@ TEST_F(ObjectBasicCRUDIntegrationTest, BasicCRUD) {
179153 << *updated_meta;
180154 EXPECT_EQ (update.metadata (), updated_meta->metadata ()) << *updated_meta;
181155 // Verify the custom contexts are updated correctly with valid timestamps.
182- EXPECT_EQ (
183- " test-custom-value" ,
184- updated_meta->contexts ().get_custom (" test-key" ).value ) << *updated_meta;
185- EXPECT_TRUE (IsSet (updated_meta->contexts ().get_custom (" test-key" ).update_time )) << *updated_meta;
186- EXPECT_TRUE (IsSet (updated_meta->contexts ().get_custom (" test-key" ).create_time )) << *updated_meta;
156+ EXPECT_EQ (" test-custom-value" ,
157+ updated_meta->contexts ().get_custom (" test-key" ).value )
158+ << *updated_meta;
159+ EXPECT_TRUE (
160+ IsSet (updated_meta->contexts ().get_custom (" test-key" ).update_time ))
161+ << *updated_meta;
162+ EXPECT_TRUE (
163+ IsSet (updated_meta->contexts ().get_custom (" test-key" ).create_time ))
164+ << *updated_meta;
187165
188166 ObjectMetadata desired_patch = *updated_meta;
189167 desired_patch.set_content_language (" en" );
0 commit comments