Skip to content

Commit

Permalink
[rptest] Auto-retry in RedpandaInstaller._avail_for_download
Browse files Browse the repository at this point in the history
  • Loading branch information
clee committed Nov 13, 2024
1 parent 2bf408d commit f67eb4b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/rptest/services/redpanda_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import typing
import threading
from datetime import datetime, timezone, timedelta
from time import sleep

import requests

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f67eb4b

Please sign in to comment.