diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-15 18:03:53 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-15 18:03:53 +0900 |
commit | b0a193b20fe18cbc4530629150eeedb745aabf6f (patch) | |
tree | 7547737f7b995de139130ca2038888478b32a1e6 /tests/frontend | |
parent | de54ba7242e44b78330e80702ab943f0081434f9 (diff) | |
download | buildstream-b0a193b20fe18cbc4530629150eeedb745aabf6f.tar.gz |
tests/frontend/push.py: Test pushing artifacts in non-strict modetristan/fix-non-strict-push-1.2
This is a regression test for issue #990
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/push.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/frontend/push.py b/tests/frontend/push.py index 33730d9e2..0839507d7 100644 --- a/tests/frontend/push.py +++ b/tests/frontend/push.py @@ -389,3 +389,49 @@ def test_push_already_cached(caplog, cli, tmpdir, datafiles): assert not result.get_pushed_elements(), "No elements should have been pushed since the cache was populated" assert "INFO Remote ({}) already has ".format(share.repo) in result.stderr assert "SKIPPED Push" in result.stderr + + +# This test ensures that we are able to run `bst 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 push`. + result = cli.run(project=project, args=['push', '--deps', 'all', 'target.bst']) + result.assert_success() |