diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-15 18:32:32 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-15 18:38:51 +0900 |
commit | b3dc50de62f469e4a8e9b339c4359a494bb03ac2 (patch) | |
tree | 28859a18b9ab0e14f640bf0a5d0ab9539b8385d0 | |
parent | 4fad0f97eaa43423c0e5197bdfec566ef56296b2 (diff) | |
download | buildstream-tristan/fix-non-strict-push.tar.gz |
tests/frontend/push.py: Test pushing artifacts in non-strict modetristan/fix-non-strict-push
This is a regression test for issue #990
-rw-r--r-- | tests/frontend/push.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/frontend/push.py b/tests/frontend/push.py index 7b4e944d4..9c7dc9616 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -454,3 +454,51 @@ def test_build_remote_option(caplog, cli, tmpdir, datafiles): assert_shared(cli, sharecli, project, element_name) assert_not_shared(cli, shareuser, project, element_name) assert_not_shared(cli, shareproject, project, element_name) + + +# This test ensures that we are able to run `bst artifact push` in non strict mode +# and that we do not crash when trying to push elements even though they +# have not yet been pulled. +# +# This is a regression test for issue #990 +# +@pytest.mark.datafiles(DATA_DIR) +def test_push_no_strict(caplog, cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + caplog.set_level(1) + + with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share: + cli.configure({ + 'artifacts': { + 'url': share.repo, + 'push': True + }, + 'projects': { + 'test': { + 'strict': False + } + } + }) + + # First get us a build + result = cli.run(project=project, args=['build', 'target.bst']) + result.assert_success() + + # Now cause one of the dependenies to change their cache key + # + # Here we just add a file, causing the strong cache key of the + # import-bin.bst element to change due to the local files it + # imports changing. + path = os.path.join(project, 'files', 'bin-files', 'newfile') + with open(path, 'w') as f: + f.write("PONY !") + + # Now build again after having changed the dependencies + result = cli.run(project=project, args=['build', 'target.bst']) + result.assert_success() + + # Now run `bst artifact push`. + result = cli.run(project=project, args=[ + 'artifact', 'push', '--deps', 'all', 'target.bst' + ]) + result.assert_success() |