diff options
author | Jürg Billeter <j@bitron.ch> | 2020-06-30 16:56:36 +0200 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-08-13 09:24:43 +0000 |
commit | 7d85545e5d8fc61de37657e4baab321d3986c3c6 (patch) | |
tree | b5b6721ce0fee30ebe91dcc021f2b2366d8a27f5 /tests | |
parent | 162dd86d466ed440c975f308a94da686740a3118 (diff) | |
download | buildstream-7d85545e5d8fc61de37657e4baab321d3986c3c6.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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/frontend/push.py | 15 |
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() |