From 57ff5dc15de7c467549fb8655e36dacda3dfccc0 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Thu, 17 Sep 2020 22:20:26 +0000 Subject: [PATCH] fix(monitoring): retry in the test setup fixes #4687 fixes #4688 fixes #4689 fixes #4690 --- monitoring/api/v3/cloud-client/snippets_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/monitoring/api/v3/cloud-client/snippets_test.py b/monitoring/api/v3/cloud-client/snippets_test.py index 23e457cd2572..6c67a421ec5c 100644 --- a/monitoring/api/v3/cloud-client/snippets_test.py +++ b/monitoring/api/v3/cloud-client/snippets_test.py @@ -17,6 +17,7 @@ import backoff from google.api_core.exceptions import NotFound +from google.api_core.exceptions import InternalServerError import pytest import snippets @@ -42,7 +43,12 @@ def custom_metric_descriptor(capsys): @pytest.fixture(scope="module") def write_time_series(): - snippets.write_time_series(PROJECT_ID) + + @backoff.on_exception(backoff.expo, InternalServerError, max_time=120) + def write(): + snippets.write_time_series(PROJECT_ID) + + write() yield