diff --git a/packages/google-cloud-monitoring/tests/system.py b/packages/google-cloud-monitoring/tests/system.py index 46eb5a40f72c..bc0209289136 100644 --- a/packages/google-cloud-monitoring/tests/system.py +++ b/packages/google-cloud-monitoring/tests/system.py @@ -178,6 +178,7 @@ def test_create_and_delete_metric_descriptor(self): retry_500(descriptor.create)() retry_404_500(descriptor.delete)() + @RetryErrors(exception=BadRequest, max_tries=2) def test_write_point(self): METRIC_TYPE = ('custom.googleapis.com/tmp/system_test_example' + unique_resource_id()) @@ -202,14 +203,19 @@ def test_write_point(self): retry_500(client.write_point)(metric, resource, VALUE) def _query_timeseries_with_retries(): - MAX_RETRIES = 10 + MAX_RETRIES = 6 def _has_timeseries(result): return len(list(result)) > 0 - retry_result = RetryResult(_has_timeseries, - max_tries=MAX_RETRIES)(client.query) - return RetryErrors(BadRequest, max_tries=MAX_RETRIES)(retry_result) + retry_result = RetryResult( + _has_timeseries, + max_tries=MAX_RETRIES, + backoff=3)(client.query) + return RetryErrors( + BadRequest, + max_tries=MAX_RETRIES, + backoff=3)(retry_result) query = _query_timeseries_with_retries()(METRIC_TYPE, minutes=5) timeseries_list = list(query)