summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-10-25 18:22:03 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-10-25 18:28:20 +0900
commitf9ddbaaa4ae14d4c733dcc011ce6fcbb39f7607f (patch)
tree252535c2943833e4d149c613cf7eb2ffb27112dc /tests
parentf2579bea17ed4660b1e06f584c62bad3ec3fcaf0 (diff)
downloadbuildstream-f9ddbaaa4ae14d4c733dcc011ce6fcbb39f7607f.tar.gz
tests/artifactcache/expiry.py: Conditionally skip some tests
Skip some of the artifact expiry tests in the case we don't have subsecond mtime precision.
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