Skip to content

Commit

Permalink
Increase backoff to fix monitoring system test (#3769)
Browse files Browse the repository at this point in the history
  • Loading branch information
liyanhui1228 authored and lukesneeringer committed Aug 9, 2017
1 parent b242099 commit 15ed5e7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions monitoring/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down

0 comments on commit 15ed5e7

Please sign in to comment.