Skip to content

Commit

Permalink
Retry on error 504 from ReportPortal
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaarreell authored and happz committed Aug 1, 2024
1 parent 5fbbd89 commit 86752f5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tmt/steps/report/reportportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ class ReportReportPortal(tmt.steps.report.ReportPlugin[ReportReportPortalData]):
def handle_response(self, response: requests.Response) -> None:
""" Check the endpoint response and raise an exception if needed """

if not response.ok:
raise tmt.utils.ReportError(
f"Received non-ok status code from ReportPortal: {response.text}")

self.debug("Response code from the endpoint", response.status_code)
self.debug("Message from the endpoint", response.text)

if not response.ok:
raise tmt.utils.ReportError(
f"Received non-ok status code {response.status_code} from ReportPortal: {response.text}")

def check_options(self) -> None:
""" Check options for known troublesome combinations """
# TODO: Update restriction of forbidden option combinations based on feedback.
Expand Down Expand Up @@ -393,7 +393,13 @@ def go(self, *, logger: Optional[tmt.log.Logger] = None) -> None:
suite_description += f"<br>{self.data.artifacts_url}"

# Communication with RP instance
with tmt.utils.retry_session() as session:
with tmt.utils.retry_session(status_forcelist=(
429, # Too Many Requests
500, # Internal Server Error
502, # Bad Gateway
503, # Service Unavailable
504, # Gateway Timeout
)) as session:

if create_launch:

Expand Down

0 comments on commit 86752f5

Please sign in to comment.