Skip to content

Commit

Permalink
Add retry in downloading python saithrift library (#14636)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingwang-ms authored and mssonicbld committed Sep 20, 2024
1 parent 3fefd8d commit 0b6259b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_pretest.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,15 @@ def test_update_saithrift_ptf(request, ptfhost):
pytest.skip("No URL specified for python saithrift package")
pkg_name = py_saithrift_url.split("/")[-1]
ptfhost.shell("rm -f {}".format(pkg_name))
result = ptfhost.get_url(url=py_saithrift_url, dest="/root", module_ignore_errors=True, timeout=60)
# Retry download of saithrift library
retry_count = 5
while retry_count > 0:
result = ptfhost.get_url(url=py_saithrift_url, dest="/root", module_ignore_errors=True, timeout=60)
if not result["failed"] or "OK" in result["msg"]:
break
time.sleep(60)
retry_count -= 1

if result["failed"] or "OK" not in result["msg"]:
pytest.skip("Download failed/error while installing python saithrift package")
ptfhost.shell("dpkg -i {}".format(os.path.join("/root", pkg_name)))
Expand Down

0 comments on commit 0b6259b

Please sign in to comment.