summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/artifactcache/expiry.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py
index f2be797c3..f56811981 100644
--- a/tests/artifactcache/expiry.py
+++ b/tests/artifactcache/expiry.py
@@ -28,6 +28,7 @@ import pytest
from buildstream._cas import CASCache
from buildstream.exceptions import ErrorDomain, LoadErrorReason
from buildstream.testing import cli # pylint: disable=unused-import
+from buildstream.testing._utils.site import have_subsecond_mtime
from tests.testutils import create_element_size, wait_for_cache_granularity
@@ -58,6 +59,17 @@ def test_artifact_expires(cli, datafiles):
project = str(datafiles)
element_path = "elements"
+ # Skip this test if we do not have support for subsecond precision mtimes
+ #
+ # The artifact expiry logic relies on mtime changes, in real life second precision
+ # should be enough for this to work almost all the time, but test cases happen very
+ # quickly, resulting in all artifacts having the same mtime.
+ #
+ # This test requires subsecond mtime to be reliable.
+ #
+ if not have_subsecond_mtime(project):
+ pytest.skip("Filesystem does not support subsecond mtime precision: {}".format(project))
+
cli.configure({"cache": {"quota": 10000000,}})
# Create an element that uses almost the entire cache (an empty
@@ -99,6 +111,17 @@ def test_artifact_too_large(cli, datafiles, size):
project = str(datafiles)
element_path = "elements"
+ # Skip this test if we do not have support for subsecond precision mtimes
+ #
+ # The artifact expiry logic relies on mtime changes, in real life second precision
+ # should be enough for this to work almost all the time, but test cases happen very
+ # quickly, resulting in all artifacts having the same mtime.
+ #
+ # This test requires subsecond mtime to be reliable.
+ #
+ if not have_subsecond_mtime(project):
+ pytest.skip("Filesystem does not support subsecond mtime precision: {}".format(project))
+
cli.configure({"cache": {"quota": 400000}})
# Create an element whose artifact is too large
@@ -169,6 +192,17 @@ def test_keep_dependencies(cli, datafiles):
project = str(datafiles)
element_path = "elements"
+ # Skip this test if we do not have support for subsecond precision mtimes
+ #
+ # The artifact expiry logic relies on mtime changes, in real life second precision
+ # should be enough for this to work almost all the time, but test cases happen very
+ # quickly, resulting in all artifacts having the same mtime.
+ #
+ # This test requires subsecond mtime to be reliable.
+ #
+ if not have_subsecond_mtime(project):
+ pytest.skip("Filesystem does not support subsecond mtime precision: {}".format(project))
+
cli.configure({"cache": {"quota": 10000000}})
# Create a pretty big dependency
@@ -210,6 +244,17 @@ def test_never_delete_required(cli, datafiles):
project = str(datafiles)
element_path = "elements"
+ # Skip this test if we do not have support for subsecond precision mtimes
+ #
+ # The artifact expiry logic relies on mtime changes, in real life second precision
+ # should be enough for this to work almost all the time, but test cases happen very
+ # quickly, resulting in all artifacts having the same mtime.
+ #
+ # This test requires subsecond mtime to be reliable.
+ #
+ if not have_subsecond_mtime(project):
+ pytest.skip("Filesystem does not support subsecond mtime precision: {}".format(project))
+
cli.configure({"cache": {"quota": 10000000}, "scheduler": {"fetchers": 1, "builders": 1}})
# Create a linear build tree