Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[monitoring] fix: mitigate flake #4153

Merged
merged 2 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
backoff===1.10.0
pytest==5.3.2
15 changes: 13 additions & 2 deletions monitoring/api/v3/uptime-check-client/snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import random
import string

import backoff
from google.api_core.exceptions import DeadlineExceeded
import pytest

import snippets
Expand Down Expand Up @@ -63,8 +65,17 @@ def test_update_uptime_config(capsys):
new_display_name = random_name(10)
new_uptime_check_path = '/' + random_name(10)
with UptimeFixture() as fixture:
snippets.update_uptime_check_config(
fixture.config.name, new_display_name, new_uptime_check_path)

# We sometimes see the permission error saying the resource
# may not exist. Weirdly DeadlineExceeded instnace is raised
# in this case.
@backoff.on_exception(backoff.expo, DeadlineExceeded, max_time=120)
def call_sample():
snippets.update_uptime_check_config(
fixture.config.name, new_display_name, new_uptime_check_path)

call_sample()

out, _ = capsys.readouterr()
snippets.get_uptime_check_config(fixture.config.name)
out, _ = capsys.readouterr()
Expand Down