Skip to content

Commit

Permalink
AIP-8440 retry opsgenie error
Browse files Browse the repository at this point in the history
  • Loading branch information
talebzeghmi committed May 22, 2024
1 parent 58ae174 commit f855780
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions metaflow/plugins/aip/tests/run_integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,19 @@ def test_error_and_opsgenie_alert(pytestconfig) -> None:
close_alert_endpoint: str = (
f"https://api.opsgenie.com/v2/alerts/{alert_alias}/close?identifierType=alias"
)
close_alert_response: Response = requests.post(
close_alert_endpoint,
data=json.dumps(close_alert_data),
headers=opsgenie_auth_headers,
)
# Sometimes the response status code is 202, signaling
# the request has been accepted and is being queued for processing.
assert (
close_alert_response.status_code == 200
or close_alert_response.status_code == 202
)

# retry 3 times with a sleep of 3s until the alert is closed
for _ in range(3):
close_alert_response: Response = requests.post(
close_alert_endpoint,
data=json.dumps(close_alert_data),
headers=opsgenie_auth_headers,
)
if close_alert_response.status_code == 200:
break
time.sleep(3)

assert close_alert_response.status_code == 200

# Test logging of raise_error_flow
check_error_handling_flow_cmd: str = (
Expand Down

0 comments on commit f855780

Please sign in to comment.