From 1e2943c4d167df2cbc4b432da21a95028dc030ef Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 27 Jun 2024 20:58:06 +0000 Subject: [PATCH] Address review comments --- google/cloud/storage/tests/object_file_integration_test.cc | 7 ++++--- google/cloud/storage/tests/object_hash_integration_test.cc | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/google/cloud/storage/tests/object_file_integration_test.cc b/google/cloud/storage/tests/object_file_integration_test.cc index 2d9df032c9327..184184a457b7f 100644 --- a/google/cloud/storage/tests/object_file_integration_test.cc +++ b/google/cloud/storage/tests/object_file_integration_test.cc @@ -32,10 +32,12 @@ namespace { using ::google::cloud::testing_util::IsOk; using ::google::cloud::testing_util::StatusIs; using ::testing::AnyOf; +using ::testing::Contains; using ::testing::ElementsAreArray; using ::testing::Eq; using ::testing::HasSubstr; using ::testing::Not; +using ::testing::Pair; class ObjectFileIntegrationTest : public google::cloud::storage::testing::StorageIntegrationTest { @@ -552,9 +554,8 @@ TEST_F(ObjectFileIntegrationTest, ResumableUploadFileCustomHeader) { auto expected_str = expected.str(); ASSERT_EQ(expected_str.size(), meta->size()); - EXPECT_THAT(meta->metadata(), - ::testing::Contains(::testing::Pair("x_emulator_custom_header", - "custom_header_value"))); + EXPECT_THAT(meta->metadata(), Contains(Pair("x_emulator_custom_header", + "custom_header_value"))); // Create an iostream to read the object back. auto stream = client->ReadObject(bucket_name_, object_name); diff --git a/google/cloud/storage/tests/object_hash_integration_test.cc b/google/cloud/storage/tests/object_hash_integration_test.cc index f83427778b84a..47a749d4ab232 100644 --- a/google/cloud/storage/tests/object_hash_integration_test.cc +++ b/google/cloud/storage/tests/object_hash_integration_test.cc @@ -199,12 +199,13 @@ TEST_F(ObjectHashIntegrationTest, WriteObjectExplicitEnable) { EXPECT_THAT(os.computed_hash(), HasSubstr(ComputeMD5Hash(LoremIpsum()))); EXPECT_THAT(os.received_hash(), HasSubstr(ComputeMD5Hash(LoremIpsum()))); if (meta->has_metadata("x_emulator_upload")) { - ASSERT_THAT(meta->metadata(), Contains(Pair("x_emulator_no_crc32c", _))); if (UsingGrpc()) { + EXPECT_THAT(meta->metadata(), Contains(Pair("x_emulator_no_crc32c", _))); EXPECT_THAT(meta->metadata(), Contains(Pair("x_emulator_md5", _))); } else { // REST cannot send the checksums computed at the end of the upload. - ASSERT_THAT(meta->metadata(), Contains(Pair("x_emulator_no_md5", _))); + EXPECT_THAT(meta->metadata(), Contains(Pair("x_emulator_no_crc32c", _))); + EXPECT_THAT(meta->metadata(), Contains(Pair("x_emulator_no_md5", _))); } } }