aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/qemu_test
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2024-12-17 15:59:52 +0000
committerThomas Huth <thuth@redhat.com>2024-12-17 19:39:53 +0100
commit674a750b51df188d6baf55f1f1f8fc6f57fcf6cf (patch)
tree2cac0ab308d45852b9bcf9b6d33856df29cb493b /tests/functional/qemu_test
parent6ff217c2d1c231f727c1be356da4a71cdfdd7ec5 (diff)
downloadqemu-674a750b51df188d6baf55f1f1f8fc6f57fcf6cf.zip
qemu-674a750b51df188d6baf55f1f1f8fc6f57fcf6cf.tar.gz
qemu-674a750b51df188d6baf55f1f1f8fc6f57fcf6cf.tar.bz2
tests/functional: ignore errors when caching assets, except for 404
We see periodic errors caching assets due to a combination of transient networking and server problems. With the previous patch to skip running a test when it has missing assets, we can now treat most cache download errors as non-fatal. Only HTTP 404 is retained as fatal, since it is a strong indicator of a fully broken test rather than a transient error. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-32-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/functional/qemu_test')
-rw-r--r--tests/functional/qemu_test/asset.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
index 39832b2..f073069 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -15,6 +15,7 @@ import urllib.request
from time import sleep
from pathlib import Path
from shutil import copyfileobj
+from urllib.error import HTTPError
# Instances of this class must be declared as class level variables
@@ -170,7 +171,18 @@ class Asset:
for name, asset in vars(test.__class__).items():
if name.startswith("ASSET_") and type(asset) == Asset:
log.info("Attempting to cache '%s'" % asset)
- asset.fetch()
+ try:
+ asset.fetch()
+ except HTTPError as e:
+ # Treat 404 as fatal, since it is highly likely to
+ # indicate a broken test rather than a transient
+ # server or networking problem
+ if e.code == 404:
+ raise
+
+ log.debug(f"HTTP error {e.code} from {asset.url} " +
+ "skipping asset precache")
+
log.removeHandler(handler)
def precache_suite(suite):