summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2019-01-22 19:59:57 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2019-01-22 19:59:57 +0000
commit56e857f41d96e20280f90c1dc994327251711bcd (patch)
treeb1ef0d0a0ccd07a330e20a38f91e0b87fff32d15
parent6e5c998736e176cb4c16a7524df9d080b5a2ce90 (diff)
parent3315b9a19ab3aec4c509ec711b49ff31209a3e7a (diff)
downloadbuildstream-56e857f41d96e20280f90c1dc994327251711bcd.tar.gz
Merge branch 'tristan/fix-pullbuildtrees-test' into 'master'
tests/integration/pullbuildtrees.py: Fix the non-integration case. See merge request BuildStream/buildstream!1098
-rw-r--r--tests/integration/pullbuildtrees.py84
1 files changed, 42 insertions, 42 deletions
diff --git a/tests/integration/pullbuildtrees.py b/tests/integration/pullbuildtrees.py
index e7ee90eee..3294c9094 100644
--- a/tests/integration/pullbuildtrees.py
+++ b/tests/integration/pullbuildtrees.py
@@ -2,7 +2,7 @@ import os
import shutil
import pytest
-from tests.testutils import cli_integration as cli, create_artifact_share
+from tests.testutils import cli, cli_integration as cli2, create_artifact_share
from tests.testutils.integration import assert_contains
from tests.testutils.site import HAVE_BWRAP, IS_LINUX
from buildstream._exceptions import ErrorDomain, LoadErrorReason
@@ -32,7 +32,7 @@ def default_state(cli, tmpdir, share):
@pytest.mark.integration
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.skipif(IS_LINUX and not HAVE_BWRAP, reason='Only available with bubblewrap on Linux')
-def test_pullbuildtrees(cli, tmpdir, datafiles):
+def test_pullbuildtrees(cli2, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
element_name = 'autotools/amhello.bst'
@@ -40,115 +40,115 @@ def test_pullbuildtrees(cli, tmpdir, datafiles):
with create_artifact_share(os.path.join(str(tmpdir), 'share1')) as share1,\
create_artifact_share(os.path.join(str(tmpdir), 'share2')) as share2,\
create_artifact_share(os.path.join(str(tmpdir), 'share3')) as share3:
- cli.configure({
+ cli2.configure({
'artifacts': {'url': share1.repo, 'push': True},
'artifactdir': os.path.join(str(tmpdir), 'artifacts')
})
# Build autotools element, checked pushed, delete local
- result = cli.run(project=project, args=['build', element_name])
+ result = cli2.run(project=project, args=['build', element_name])
assert result.exit_code == 0
- assert cli.get_element_state(project, element_name) == 'cached'
- assert share1.has_artifact('test', element_name, cli.get_element_key(project, element_name))
- default_state(cli, tmpdir, share1)
+ assert cli2.get_element_state(project, element_name) == 'cached'
+ assert share1.has_artifact('test', element_name, cli2.get_element_key(project, element_name))
+ default_state(cli2, tmpdir, share1)
# Pull artifact with default config, assert that pulling again
# doesn't create a pull job, then assert with buildtrees user
# config set creates a pull job.
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name not in result.get_pulled_elements()
- cli.configure({'cache': {'pull-buildtrees': True}})
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ cli2.configure({'cache': {'pull-buildtrees': True}})
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- default_state(cli, tmpdir, share1)
+ default_state(cli2, tmpdir, share1)
# Pull artifact with default config, then assert that pulling
# with buildtrees cli flag set creates a pull job.
# Also assert that the buildtree is added to the artifact's
# extract dir
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- elementdigest = share1.has_artifact('test', element_name, cli.get_element_key(project, element_name))
+ elementdigest = share1.has_artifact('test', element_name, cli2.get_element_key(project, element_name))
buildtreedir = os.path.join(str(tmpdir), 'artifacts', 'extract', 'test', 'autotools-amhello',
elementdigest.hash, 'buildtree')
assert not os.path.isdir(buildtreedir)
- result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
assert os.path.isdir(buildtreedir)
- default_state(cli, tmpdir, share1)
+ default_state(cli2, tmpdir, share1)
# Pull artifact with pullbuildtrees set in user config, then assert
# that pulling with the same user config doesn't creates a pull job,
# or when buildtrees cli flag is set.
- cli.configure({'cache': {'pull-buildtrees': True}})
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ cli2.configure({'cache': {'pull-buildtrees': True}})
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name not in result.get_pulled_elements()
- result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
assert element_name not in result.get_pulled_elements()
- default_state(cli, tmpdir, share1)
+ default_state(cli2, tmpdir, share1)
# Pull artifact with default config and buildtrees cli flag set, then assert
# that pulling with pullbuildtrees set in user config doesn't create a pull
# job.
- result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- cli.configure({'cache': {'pull-buildtrees': True}})
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ cli2.configure({'cache': {'pull-buildtrees': True}})
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name not in result.get_pulled_elements()
- default_state(cli, tmpdir, share1)
+ default_state(cli2, tmpdir, share1)
# Assert that a partial build element (not containing a populated buildtree dir)
# can't be pushed to an artifact share, then assert that a complete build element
# can be. This will attempt a partial pull from share1 and then a partial push
# to share2
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- cli.configure({'artifacts': {'url': share2.repo, 'push': True}})
- result = cli.run(project=project, args=['artifact', 'push', element_name])
+ cli2.configure({'artifacts': {'url': share2.repo, 'push': True}})
+ result = cli2.run(project=project, args=['artifact', 'push', element_name])
assert element_name not in result.get_pushed_elements()
- assert not share2.has_artifact('test', element_name, cli.get_element_key(project, element_name))
+ assert not share2.has_artifact('test', element_name, cli2.get_element_key(project, element_name))
# Assert that after pulling the missing buildtree the element artifact can be
# successfully pushed to the remote. This will attempt to pull the buildtree
# from share1 and then a 'complete' push to share2
- cli.configure({'artifacts': {'url': share1.repo, 'push': False}})
- result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
+ cli2.configure({'artifacts': {'url': share1.repo, 'push': False}})
+ result = cli2.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- cli.configure({'artifacts': {'url': share2.repo, 'push': True}})
- result = cli.run(project=project, args=['artifact', 'push', element_name])
+ cli2.configure({'artifacts': {'url': share2.repo, 'push': True}})
+ result = cli2.run(project=project, args=['artifact', 'push', element_name])
assert element_name in result.get_pushed_elements()
- assert share2.has_artifact('test', element_name, cli.get_element_key(project, element_name))
- default_state(cli, tmpdir, share1)
+ assert share2.has_artifact('test', element_name, cli2.get_element_key(project, element_name))
+ default_state(cli2, tmpdir, share1)
# Assert that bst push will automatically attempt to pull a missing buildtree
# if pull-buildtrees is set, however as share3 is the only defined remote and is empty,
# assert that no element artifact buildtrees are pulled (no available remote buildtree) and thus the
# artifact cannot be pushed.
- result = cli.run(project=project, args=['artifact', 'pull', element_name])
+ result = cli2.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
- cli.configure({'artifacts': {'url': share3.repo, 'push': True}})
- result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
+ cli2.configure({'artifacts': {'url': share3.repo, 'push': True}})
+ result = cli2.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
assert "Attempting to fetch missing artifact buildtrees" in result.stderr
assert element_name not in result.get_pulled_elements()
assert not os.path.isdir(buildtreedir)
assert element_name not in result.get_pushed_elements()
- assert not share3.has_artifact('test', element_name, cli.get_element_key(project, element_name))
+ assert not share3.has_artifact('test', element_name, cli2.get_element_key(project, element_name))
# Assert that if we add an extra remote that has the buildtree artfact cached, bst push will
# automatically attempt to pull it and will be successful, leading to the full artifact being pushed
# to the empty share3. This gives the ability to attempt push currently partial artifacts to a remote,
# without exlipictly requiring a bst pull.
- cli.configure({'artifacts': [{'url': share1.repo, 'push': False}, {'url': share3.repo, 'push': True}]})
- result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
+ cli2.configure({'artifacts': [{'url': share1.repo, 'push': False}, {'url': share3.repo, 'push': True}]})
+ result = cli2.run(project=project, args=['--pull-buildtrees', 'artifact', 'push', element_name])
assert "Attempting to fetch missing artifact buildtrees" in result.stderr
assert element_name in result.get_pulled_elements()
assert os.path.isdir(buildtreedir)
assert element_name in result.get_pushed_elements()
- assert share3.has_artifact('test', element_name, cli.get_element_key(project, element_name))
+ assert share3.has_artifact('test', element_name, cli2.get_element_key(project, element_name))
# Ensure that only valid pull-buildtrees boolean options make it through the loading