From f9ddbaaa4ae14d4c733dcc011ce6fcbb39f7607f Mon Sep 17 00:00:00 2001 From: Tristan van Berkom Date: Sun, 25 Oct 2020 18:22:03 +0900 Subject: 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. --- tests/artifactcache/expiry.py | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) 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 -- cgit v1.2.1