tests/functional: enable force refresh of cached assets

If the 'QEMU_TEST_REFRESH_CACHE' environment variable is set, then
ignore any existing cached asset and download a fresh copy.

This can be used to selectively refresh assets if set before running
a single test script.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250829142616.2633254-2-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2025-09-09 09:57:51 +02:00
committed by Thomas Huth
parent 5f81033e5b
commit 9f80f3695d
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -312,6 +312,9 @@ The cache is populated in the ``~/.cache/qemu/download`` directory by
default, but the location can be changed by setting the
``QEMU_TEST_CACHE_DIR`` environment variable.
To force the test suite to re-download the cache, even if still valid,
set the ``QEMU_TEST_REFRESH_CACHE`` environment variable.
Skipping tests
--------------
+4
View File
@@ -72,6 +72,10 @@ class Asset:
return self.hash == hl.hexdigest()
def valid(self):
if os.getenv("QEMU_TEST_REFRESH_CACHE", None) is not None:
self.log.info("Force refresh of asset %s", self.url)
return False
return self.cache_file.exists() and self._check(self.cache_file)
def fetchable(self):