diff --git a/monitoring/api/v3/alerts-client/requirements-test.txt b/monitoring/api/v3/alerts-client/requirements-test.txt index 781d4326c947..758bc040f3a8 100644 --- a/monitoring/api/v3/alerts-client/requirements-test.txt +++ b/monitoring/api/v3/alerts-client/requirements-test.txt @@ -1 +1,3 @@ pytest==5.3.2 +gcp-devrel-py-tools==0.0.15 +google-cloud-core diff --git a/monitoring/api/v3/alerts-client/snippets_test.py b/monitoring/api/v3/alerts-client/snippets_test.py index bd0cf4011924..7ff26335a830 100644 --- a/monitoring/api/v3/alerts-client/snippets_test.py +++ b/monitoring/api/v3/alerts-client/snippets_test.py @@ -17,6 +17,7 @@ import random import string +from gcp_devrel.testing import eventually_consistent from google.cloud import monitoring_v3 import google.protobuf.json_format import pytest @@ -74,12 +75,14 @@ def pochan(): yield pochan +@eventually_consistent.mark def test_list_alert_policies(capsys, pochan): snippets.list_alert_policies(pochan.project_name) out, _ = capsys.readouterr() assert pochan.alert_policy.display_name in out +@eventually_consistent.mark def test_enable_alert_policies(capsys, pochan): snippets.enable_alert_policies(pochan.project_name, False) out, _ = capsys.readouterr() @@ -97,6 +100,7 @@ def test_enable_alert_policies(capsys, pochan): assert "already enabled" in out +@eventually_consistent.mark def test_replace_channels(capsys, pochan): alert_policy_id = pochan.alert_policy.name.split('/')[-1] notification_channel_id = pochan.notification_channel.name.split('/')[-1] @@ -106,6 +110,7 @@ def test_replace_channels(capsys, pochan): assert "Updated {0}".format(pochan.alert_policy.name) in out +@eventually_consistent.mark def test_backup_and_restore(capsys, pochan): snippets.backup(pochan.project_name, 'backup.json') out, _ = capsys.readouterr() @@ -117,6 +122,7 @@ def test_backup_and_restore(capsys, pochan): pochan.notification_channel.display_name) in out +@eventually_consistent.mark def test_delete_channels(capsys, pochan): notification_channel_id = pochan.notification_channel.name.split('/')[-1] snippets.delete_notification_channels(