@@ -54,7 +54,7 @@ TEST_F(ObjectChecksumIntegrationTest, InsertObjectDefault) {
5454 auto client = MakeIntegrationTestClient ();
5555 auto object_name = MakeRandomObjectName ();
5656 auto meta = client.InsertObject (bucket_name_, object_name, LoremIpsum (),
57- Options{}. set <UploadChecksumValidationOption>(ChecksumAlgorithm:: kCrc32c ), IfGenerationMatch (0 ));
57+ IfGenerationMatch (0 ));
5858 ASSERT_STATUS_OK (meta);
5959 ScheduleForDelete (*meta);
6060
@@ -64,12 +64,16 @@ TEST_F(ObjectChecksumIntegrationTest, InsertObjectDefault) {
6464 }
6565}
6666
67- // / @test Verify that `Options{}.set<UploadChecksumValidationOption>(ChecksumAlgorithm::kMD5)` works as expected.
67+ // / @test Verify that
68+ // / `Options{}.set<UploadChecksumValidationOption>(ChecksumAlgorithm::kMD5)`
69+ // / works as expected.
6870TEST_F (ObjectChecksumIntegrationTest, InsertObjectExplicitDisable) {
6971 auto client = MakeIntegrationTestClient ();
7072 auto object_name = MakeRandomObjectName ();
71- auto meta = client.InsertObject (bucket_name_, object_name, LoremIpsum (),
72- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kNone ), IfGenerationMatch (0 ));
73+ auto meta = client.InsertObject (
74+ bucket_name_, object_name, LoremIpsum (),
75+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kNone ),
76+ IfGenerationMatch (0 ));
7377 ASSERT_STATUS_OK (meta);
7478 ScheduleForDelete (*meta);
7579
@@ -79,13 +83,17 @@ TEST_F(ObjectChecksumIntegrationTest, InsertObjectExplicitDisable) {
7983 }
8084}
8185
82- // / @test Verify that `Options{}.set<UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c)` works as expected.
86+ // / @test Verify that
87+ // / `Options{}.set<UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c)`
88+ // / works as expected.
8389TEST_F (ObjectChecksumIntegrationTest, InsertObjectExplicitEnable) {
8490 auto client = MakeIntegrationTestClient ();
8591 auto object_name = MakeRandomObjectName ();
8692
87- auto meta = client.InsertObject (bucket_name_, object_name, LoremIpsum (),
88- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
93+ auto meta = client.InsertObject (
94+ bucket_name_, object_name, LoremIpsum (),
95+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
96+ IfGenerationMatch (0 ));
8997 ASSERT_STATUS_OK (meta);
9098 ScheduleForDelete (*meta);
9199
@@ -102,7 +110,8 @@ TEST_F(ObjectChecksumIntegrationTest, InsertObjectWithValueSuccess) {
102110 auto meta = client.InsertObject (
103111 bucket_name_, object_name, LoremIpsum (),
104112 Crc32cChecksumValue (ComputeCrc32cChecksum (LoremIpsum ())),
105- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
113+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
114+ IfGenerationMatch (0 ));
106115 ASSERT_STATUS_OK (meta);
107116 ScheduleForDelete (*meta);
108117
@@ -120,7 +129,8 @@ TEST_F(ObjectChecksumIntegrationTest, InsertObjectWithValueFailure) {
120129 auto object_name = MakeRandomObjectName ();
121130
122131 auto failure = client.InsertObject (
123- bucket_name_, object_name, LoremIpsum (), Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
132+ bucket_name_, object_name, LoremIpsum (),
133+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
124134 IfGenerationMatch (0 ), Crc32cChecksumValue (ComputeCrc32cChecksum (" " )));
125135 EXPECT_THAT (failure, Not (IsOk ()));
126136}
@@ -130,8 +140,7 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectDefault) {
130140 auto client = MakeIntegrationTestClient ();
131141 auto object_name = MakeRandomObjectName ();
132142
133- auto os = client.WriteObject (bucket_name_, object_name, Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
134- IfGenerationMatch (0 ));
143+ auto os = client.WriteObject (bucket_name_, object_name, IfGenerationMatch (0 ));
135144 os << LoremIpsum ();
136145 os.Close ();
137146 auto meta = os.metadata ();
@@ -155,8 +164,10 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectExplicitDisable) {
155164 auto client = MakeIntegrationTestClient ();
156165 auto object_name = MakeRandomObjectName ();
157166
158- auto os =
159- client.WriteObject (bucket_name_, object_name, Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kNone ), IfGenerationMatch (0 ));
167+ auto os = client.WriteObject (
168+ bucket_name_, object_name,
169+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kNone ),
170+ IfGenerationMatch (0 ));
160171 os << LoremIpsum ();
161172 os.Close ();
162173 auto meta = os.metadata ();
@@ -178,8 +189,10 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectExplicitDisable) {
178189TEST_F (ObjectChecksumIntegrationTest, WriteObjectExplicitEnable) {
179190 auto client = MakeIntegrationTestClient ();
180191 auto object_name = MakeRandomObjectName ();
181- auto os = client.WriteObject (bucket_name_, object_name,
182- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
192+ auto os = client.WriteObject (
193+ bucket_name_, object_name,
194+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
195+ IfGenerationMatch (0 ));
183196 os << LoremIpsum ();
184197 os.Close ();
185198 auto meta = os.metadata ();
@@ -204,7 +217,8 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectWithValueSuccess) {
204217 auto os = client.WriteObject (
205218 bucket_name_, object_name,
206219 Crc32cChecksumValue (ComputeCrc32cChecksum (LoremIpsum ())),
207- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
220+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
221+ IfGenerationMatch (0 ));
208222 os << LoremIpsum ();
209223 os.Close ();
210224 auto meta = os.metadata ();
@@ -227,7 +241,8 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectWithValueFailure) {
227241
228242 auto os = client.WriteObject (
229243 bucket_name_, object_name, MD5HashValue (ComputeMD5Hash (" " )),
230- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kMD5 ), IfGenerationMatch (0 ));
244+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kMD5 ),
245+ IfGenerationMatch (0 ));
231246 os << LoremIpsum ();
232247 os.Close ();
233248 auto meta = os.metadata ();
@@ -246,7 +261,8 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectReceiveBadChecksum) {
246261
247262 // Create a stream to upload an object.
248263 ObjectWriteStream stream = client.WriteObject (
249- bucket_name_, object_name, Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
264+ bucket_name_, object_name,
265+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
250266 CustomHeader (" x-goog-emulator-instructions" , " inject-upload-data-error" ),
251267 IfGenerationMatch (0 ));
252268 stream << LoremIpsum () << " \n " ;
@@ -267,7 +283,8 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectUploadBadChecksum) {
267283 // Create a stream to upload an object.
268284 ObjectWriteStream stream = client.WriteObject (
269285 bucket_name_, object_name, Crc32cChecksumValue (ComputeCrc32cChecksum (" " )),
270- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
286+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
287+ IfGenerationMatch (0 ));
271288 stream << LoremIpsum () << " \n " ;
272289 stream.Close ();
273290 EXPECT_TRUE (stream.bad ());
@@ -281,8 +298,10 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectWithFullChecksumValidation) {
281298 auto content = LoremIpsum ();
282299 auto expected_crc32c = ComputeCrc32cChecksum (content);
283300
284- auto os = client.WriteObject (bucket_name_, object_name,
285- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
301+ auto os = client.WriteObject (
302+ bucket_name_, object_name,
303+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
304+ IfGenerationMatch (0 ));
286305 os << content;
287306 os.Close ();
288307 auto meta = os.metadata ();
@@ -310,9 +329,10 @@ TEST_F(ObjectChecksumIntegrationTest, WriteObjectWithIncorrectChecksumValue) {
310329 auto bad_crc32c =
311330 ComputeCrc32cChecksum (" this is not the data being uploaded" );
312331
313- auto os = client.WriteObject (bucket_name_, object_name,
314- Crc32cChecksumValue (bad_crc32c),
315- Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ), IfGenerationMatch (0 ));
332+ auto os = client.WriteObject (
333+ bucket_name_, object_name, Crc32cChecksumValue (bad_crc32c),
334+ Options{}.set <UploadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
335+ IfGenerationMatch (0 ));
316336
317337 os << content;
318338 os.Close ();
@@ -358,7 +378,9 @@ TEST_F(ObjectChecksumIntegrationTest, ReadObjectCorruptedByServerGetc) {
358378 ScheduleForDelete (*meta);
359379
360380 auto stream = client.ReadObject (
361- bucket_name_, object_name, Options{}.set <DownloadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
381+ bucket_name_, object_name,
382+ Options{}.set <DownloadChecksumValidationOption>(
383+ ChecksumAlgorithm::kCrc32c ),
362384 CustomHeader (" x-goog-emulator-instructions" , " return-corrupted-data" ));
363385
364386#if GOOGLE_CLOUD_CPP_HAVE_EXCEPTIONS
@@ -398,7 +420,9 @@ TEST_F(ObjectChecksumIntegrationTest, ReadObjectCorruptedByServerRead) {
398420 ScheduleForDelete (*meta);
399421
400422 auto stream = client.ReadObject (
401- bucket_name_, object_name, Options{}.set <DownloadChecksumValidationOption>(ChecksumAlgorithm::kCrc32c ),
423+ bucket_name_, object_name,
424+ Options{}.set <DownloadChecksumValidationOption>(
425+ ChecksumAlgorithm::kCrc32c ),
402426 CustomHeader (" x-goog-emulator-instructions" , " return-corrupted-data" ));
403427
404428 // Create a buffer large enough to read the full contents.
0 commit comments