From a3131d285f881e5ecd43bc2b88ea9519c505f1ab Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 25 Jul 2024 02:37:01 +0000 Subject: [PATCH] Deflake integration test --- .../tests/async_client_integration_test.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/google/cloud/storage/tests/async_client_integration_test.cc b/google/cloud/storage/tests/async_client_integration_test.cc index 17c5d4b79fbbb..2d473837b2485 100644 --- a/google/cloud/storage/tests/async_client_integration_test.cc +++ b/google/cloud/storage/tests/async_client_integration_test.cc @@ -19,6 +19,7 @@ #include "google/cloud/storage/async/idempotency_policy.h" #include "google/cloud/storage/grpc_plugin.h" #include "google/cloud/storage/testing/storage_integration_test.h" +#include "google/cloud/grpc_options.h" #include "google/cloud/internal/getenv.h" #include "google/cloud/testing_util/is_proto_equal.h" #include "google/cloud/testing_util/status_matchers.h" @@ -71,7 +72,9 @@ class AsyncClientIntegrationTest auto TestOptions() { // Disable metrics in the test, they just make the logs harder to grok. - return Options{}.set(false); + return Options{} + .set(false) + .set(1); } auto AlwaysRetry() { @@ -195,9 +198,10 @@ TEST_F(AsyncClientIntegrationTest, StreamingRead) { insert_data.begin(), insert_data.end(), static_cast(0), [](auto a, auto const& b) { return a + b.size(); }); - auto insert = - async.InsertObject(BucketName(bucket_name()), object_name, insert_data) - .get(); + auto insert = async + .InsertObject(BucketName(bucket_name()), object_name, + insert_data, AlwaysRetry()) + .get(); ASSERT_STATUS_OK(insert); ScheduleForDelete(*insert); @@ -240,9 +244,10 @@ TEST_F(AsyncClientIntegrationTest, StreamingReadRange) { for (int i = 0; i != kLineCount; ++i) contents += block; auto const expected_insert_size = contents.size(); - auto insert = - async.InsertObject(BucketName(bucket_name()), object_name, contents) - .get(); + auto insert = async + .InsertObject(BucketName(bucket_name()), object_name, + contents, AlwaysRetry()) + .get(); ASSERT_STATUS_OK(insert); ScheduleForDelete(*insert);