From 7d85545e5d8fc61de37657e4baab321d3986c3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Tue, 30 Jun 2020 16:56:36 +0200 Subject: tests/frontend/push.py: Pull complete artifact Use a separate Cli instance with a separate local cache for the second pull in `test_recently_pulled_artifact_does_not_expire()` to ensure the complete artifact is pulled. If only a part of the artifact is pulled, there is no guarantee that the other blobs of that artifact won't expire. --- tests/frontend/push.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/frontend/push.py b/tests/frontend/push.py index 50e35461f..3a0afbd87 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -29,6 +29,7 @@ import pytest from buildstream.exceptions import ErrorDomain from buildstream.testing import cli, generate_project # pylint: disable=unused-import +from buildstream.testing.runcli import Cli from tests.testutils import ( create_artifact_share, create_element_size, @@ -497,16 +498,16 @@ def test_recently_pulled_artifact_does_not_expire(cli, datafiles, tmpdir): assert_shared(cli, share, project, "element1.bst") assert_shared(cli, share, project, "element2.bst") - # Remove element1 from the local cache - cli.remove_artifact_from_cache(project, "element1.bst") - assert cli.get_element_state(project, "element1.bst") != "cached" - - # Pull the element1 from the remote cache (this should update its mtime) - result = cli.run(project=project, args=["artifact", "pull", "element1.bst", "--remote", share.repo]) + # Pull the element1 from the remote cache (this should update its mtime). + # Use a separate local cache for this to ensure the complete element is pulled. + cli2_path = os.path.join(str(tmpdir), "cli2") + os.mkdir(cli2_path) + cli2 = Cli(cli2_path) + result = cli2.run(project=project, args=["artifact", "pull", "element1.bst", "--remote", share.repo]) result.assert_success() # Ensure element1 is cached locally - assert cli.get_element_state(project, "element1.bst") == "cached" + assert cli2.get_element_state(project, "element1.bst") == "cached" wait_for_cache_granularity() -- cgit v1.2.1