summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-06-30 16:56:36 +0200
committerJürg Billeter <j@bitron.ch>2020-08-12 22:03:56 +0200
commitdbfaee615490dab0890a51859dba1b1bc0a2e0ed (patch)
tree0e8e1a7999b4a4249309dd15dd9d49a676d776a3
parent13a4571abae2df7d2564bc4f296488a72b225e66 (diff)
downloadbuildstream-dbfaee615490dab0890a51859dba1b1bc0a2e0ed.tar.gz
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.
-rw-r--r--tests/frontend/push.py15
1 files 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()