summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2018-06-12 17:27:32 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2018-06-15 10:46:59 +0100
commit94934db713e09d5af0c503812ed1de122213624f (patch)
treea2a158bdc8171849da8e47cc0720ce5ee9201693
parent43dfbf3f49a606f4ee280da38cfa0a8e0fe66108 (diff)
downloadbuildstream-richardmaw/cache-fail.tar.gz
tests/integration/cachedfail.py: Test artifact pushrichardmaw/cache-fail
-rw-r--r--tests/integration/cachedfail.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py
index abe03eb0e..3135438ce 100644
--- a/tests/integration/cachedfail.py
+++ b/tests/integration/cachedfail.py
@@ -4,7 +4,8 @@ import pytest
from buildstream import _yaml
from buildstream._exceptions import ErrorDomain
-from tests.testutils import cli_integration as cli
+from tests.testutils import cli_integration as cli, create_artifact_share
+from tests.testutils.site import IS_LINUX
pytestmark = pytest.mark.integration
@@ -116,3 +117,45 @@ def test_build_depend_on_cached_fail(cli, tmpdir, datafiles):
# Assert that it's not yet built, since one of its dependencies isn't ready.
assert cli.get_element_state(project, 'target.bst') == 'waiting'
+
+
+@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize("on_error", ("continue", "quit"))
+def test_push_cached_fail(cli, tmpdir, datafiles, on_error):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ element_path = os.path.join(project, 'elements', 'element.bst')
+ workspace = os.path.join(cli.directory, 'workspace')
+ checkout = os.path.join(cli.directory, 'checkout')
+
+ # Write out our test target
+ element = {
+ 'kind': 'script',
+ 'depends': [
+ {
+ 'filename': 'base.bst',
+ 'type': 'build',
+ },
+ ],
+ 'config': {
+ 'commands': [
+ 'false',
+ ],
+ },
+ }
+ _yaml.dump(element, element_path)
+
+ share = create_artifact_share(os.path.join(str(tmpdir), 'remote'))
+
+ cli.configure({
+ 'artifacts': {'url': share.repo, 'push': True},
+ })
+
+ # Build the element, continuing to finish active jobs on error.
+ result = cli.run(project=project, args=['--on-error={}'.format(on_error), 'build', 'element.bst'])
+ result.assert_main_error(ErrorDomain.STREAM, None)
+
+ # This element should have failed
+ assert cli.get_element_state(project, 'element.bst') == 'failed'
+ # This element should have been pushed to the remote
+ assert share.has_artifact('test', 'element.bst', cli.get_element_key(project, 'element.bst'))