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-09 16:06:40 +0200 |
commit | d6fb4374e36ba13d1d876072261f56a2b9f6c335 (patch) | |
tree | 894af35e67a4a5646c02f5c95b5da2f81a03ec03 | |
parent | 2926052a636867f37c6877a882d809260d3a49ec (diff) | |
download | buildstream-juerg/duplicate-artifact-job.tar.gz |
tests/frontend/push.py: Test artifact push with globjuerg/duplicate-artifact-job
-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 |