Skip to content

Commit 91858c7

Browse files
author
Takashi Matsuo
authored
testing(automl): retry upon InternalServerError (#4350)
fixes #4343
1 parent 3a2845a commit 91858c7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

automl/cloud-client/list_operation_status_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
import os
1616

17+
import backoff
18+
from google.api_core.exceptions import InternalServerError
1719
import pytest
1820

1921
import list_operation_status
@@ -23,6 +25,11 @@
2325

2426
@pytest.mark.slow
2527
def test_list_operation_status(capsys):
26-
list_operation_status.list_operation_status(PROJECT_ID)
28+
# We saw 500 InternalServerError. Now we just retry few times.
29+
@backoff.on_exception(backoff.expo, InternalServerError, max_time=120)
30+
def run_sample():
31+
list_operation_status.list_operation_status(PROJECT_ID)
32+
33+
run_sample()
2734
out, _ = capsys.readouterr()
2835
assert "Operation details" in out

0 commit comments

Comments
 (0)