From 6e3aaade39c2d723c8dc59595507b5e81338cafd Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 18 Jun 2021 09:46:04 -0400 Subject: [PATCH] chore: fix flaky samples test due to truncated string (#156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes the flaky test reported in #149 where string `'snippets-test-enclcibdnr'`, as an example, is not found in string `'snippets-test-enclci...jects/'` because the string is truncated. We can avoid the issue by casting to `str()` before calling `print()`. Fixes #149 🦕 --- .../samples/snippets/v3/alerts-client/snippets.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-monitoring/samples/snippets/v3/alerts-client/snippets.py b/packages/google-cloud-monitoring/samples/snippets/v3/alerts-client/snippets.py index fa9c2d9fb54b..d34e039095aa 100644 --- a/packages/google-cloud-monitoring/samples/snippets/v3/alerts-client/snippets.py +++ b/packages/google-cloud-monitoring/samples/snippets/v3/alerts-client/snippets.py @@ -30,9 +30,11 @@ def list_alert_policies(project_name): client = monitoring_v3.AlertPolicyServiceClient() policies = client.list_alert_policies(name=project_name) print( - tabulate.tabulate( - [(policy.name, policy.display_name) for policy in policies], - ("name", "display_name"), + str( + tabulate.tabulate( + [(policy.name, policy.display_name) for policy in policies], + ("name", "display_name"), + ) ) )