From fe0dfe7fffddbbc2f9fd6a862ac27e3401524105 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Sat, 26 Jun 2021 07:50:22 -0400 Subject: [PATCH] chore: attempt to fix flaky snippet test test_list_alert_policies (#167) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #149 🦕 --- monitoring/snippets/v3/alerts-client/snippets_test.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/monitoring/snippets/v3/alerts-client/snippets_test.py b/monitoring/snippets/v3/alerts-client/snippets_test.py index c6316533589b..7acc98123e1e 100644 --- a/monitoring/snippets/v3/alerts-client/snippets_test.py +++ b/monitoring/snippets/v3/alerts-client/snippets_test.py @@ -123,18 +123,16 @@ def pochan(): def test_list_alert_policies(capsys, pochan): - # Query snippets.list_alert_policies() for up to 5 seconds + # Query snippets.list_alert_policies() for up to 50 seconds # to allow the newly created policy to appear in the list. retry = 5 while retry: snippets.list_alert_policies(pochan.project_name) out, _ = capsys.readouterr() - # Only check up to the first 20 characters of the display name - # as long strings printed to the console are truncated. - if pochan.alert_policy.display_name[0:20] in out: + if pochan.alert_policy.display_name in out: break retry = retry - 1 - time.sleep(1) + time.sleep(10) assert retry > 0