diff options
author | Jürg Billeter <j@bitron.ch> | 2020-09-09 15:39:12 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-09-10 17:22:37 +0200 |
commit | a1252b72e9605c09519fd247ab6b90fea106cd54 (patch) | |
tree | 2aeb941d6dde5c0bdea4a038ec5c8bd8f5d5dbf5 /tests/frontend/push.py | |
parent | a6f490a551928c1d39453585a220ddadbd8ffe24 (diff) | |
download | buildstream-a1252b72e9605c09519fd247ab6b90fea106cd54.tar.gz |
tests/frontend/push.py: Test artifact push with glob
Diffstat (limited to 'tests/frontend/push.py')
-rw-r--r-- | tests/frontend/push.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/frontend/push.py b/tests/frontend/push.py index 3a0afbd87..ffcc166f9 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -142,6 +142,36 @@ def test_push_artifact(cli, tmpdir, datafiles): assert_shared(cli, share, project, element) +@pytest.mark.datafiles(DATA_DIR) +def test_push_artifact_glob(cli, tmpdir, datafiles): + project = str(datafiles) + element = "target.bst" + + # Configure a local cache + local_cache = os.path.join(str(tmpdir), "cache") + cli.configure({"cachedir": local_cache}) + + with create_artifact_share(os.path.join(str(tmpdir), "artifactshare")) as share: + + # First build it without the artifact cache configured + result = cli.run(project=project, args=["build", element]) + result.assert_success() + + # Assert that the *artifact* is cached locally + cache_key = cli.get_element_key(project, element) + artifact_ref = os.path.join("test", os.path.splitext(element)[0], cache_key) + assert os.path.exists(os.path.join(local_cache, "artifacts", "refs", artifact_ref)) + + # Configure artifact share + cli.configure({"artifacts": {"url": share.repo, "push": True}}) + + # Run bst artifact push with a wildcard. + # This matches two artifact refs (weak and strong cache keys). + result = cli.run(project=project, args=["artifact", "push", "test/target/*"]) + result.assert_success() + assert len(result.get_pushed_elements()) == 2 + + # Tests that: # # * `bst artifact push` fails if the element is not cached locally |