From f67eb4bda4f463ca5b15106887d3aba7f8730cad Mon Sep 17 00:00:00 2001 From: Chris Lee Date: Wed, 13 Nov 2024 14:11:35 -0500 Subject: [PATCH] [rptest] Auto-retry in RedpandaInstaller._avail_for_download --- tests/rptest/services/redpanda_installer.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/rptest/services/redpanda_installer.py b/tests/rptest/services/redpanda_installer.py index 94af2fab0a7d3..66b345285f0b8 100644 --- a/tests/rptest/services/redpanda_installer.py +++ b/tests/rptest/services/redpanda_installer.py @@ -15,6 +15,7 @@ import typing import threading from datetime import datetime, timezone, timedelta +from time import sleep import requests @@ -447,7 +448,17 @@ def _avail_for_download(self, version: tuple[int, int, int]): """ r = requests.head(self._version_package_url(version)) # allow 403 ClientError, it usually indicates Unauthorized get and can happen on S3 while dealing with old releases - if r.status_code not in (200, 403, 404): + allowed = (200, 403, 404) + if r.status_code not in allowed: + num_retries = 3 + while num_retries > 0: + r = requests.head(self._version_package_url(version)) + if r.status_code in allowed: + break + num_retries -= 1 + sleep(5.0) + + if r.status_code not in allowed: r.raise_for_status() if r.status_code == 403: