summaryrefslogtreecommitdiff
path: root/tests/integration/artifact.py
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-02-11 12:07:55 +0000
committerJürg Billeter <j@bitron.ch>2019-02-19 17:05:17 +0000
commit4b62b9362870045a6203d01f2abf3e437bf23ae6 (patch)
tree36377248836d2f6e8e25d87a81a7de1bd27bc722 /tests/integration/artifact.py
parentc7f76268cc6f35209587749df85f3af9cfbaabf1 (diff)
downloadbuildstream-4b62b9362870045a6203d01f2abf3e437bf23ae6.tar.gz
context: remove artifactdir
Will check and move old artifact directory if it exists, and create symlink linking old directory to new. Part of #870
Diffstat (limited to 'tests/integration/artifact.py')
-rw-r--r--tests/integration/artifact.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/integration/artifact.py b/tests/integration/artifact.py
index c36bc6aa9..35cad2599 100644
--- a/tests/integration/artifact.py
+++ b/tests/integration/artifact.py
@@ -53,7 +53,7 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
create_artifact_share(os.path.join(str(tmpdir), 'share3')) as share3:
cli.configure({
'artifacts': {'url': share1.repo, 'push': True},
- 'artifactdir': os.path.join(str(tmpdir), 'artifacts')
+ 'cachedir': str(tmpdir)
})
# Build autotools element with cache-buildtrees set via the
@@ -69,20 +69,22 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
# to not cache buildtrees
cache_key = cli.get_element_key(project, element_name)
elementdigest = share1.has_artifact('test', element_name, cache_key)
- buildtreedir = os.path.join(str(tmpdir), 'artifacts', 'extract', 'test', 'autotools-amhello',
+ buildtreedir = os.path.join(str(tmpdir), 'extract', 'test', 'autotools-amhello',
elementdigest.hash, 'buildtree')
assert os.path.isdir(buildtreedir)
assert not os.listdir(buildtreedir)
# Delete the local cached artifacts, and assert the when pulled with --pull-buildtrees
# that is was cached in share1 as expected with an empty buildtree dir
- shutil.rmtree(os.path.join(str(tmpdir), 'artifacts'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'cas'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'extract'))
assert cli.get_element_state(project, element_name) != 'cached'
result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
assert os.path.isdir(buildtreedir)
assert not os.listdir(buildtreedir)
- shutil.rmtree(os.path.join(str(tmpdir), 'artifacts'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'cas'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'extract'))
# Assert that the default behaviour of pull to not include buildtrees on the artifact
# in share1 which was purposely cached with an empty one behaves as expected. As such the
@@ -91,13 +93,14 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
result = cli.run(project=project, args=['artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
assert not os.path.isdir(buildtreedir)
- shutil.rmtree(os.path.join(str(tmpdir), 'artifacts'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'cas'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'extract'))
# Repeat building the artifacts, this time with the default behaviour of caching buildtrees,
# as such the buildtree dir should not be empty
cli.configure({
'artifacts': {'url': share2.repo, 'push': True},
- 'artifactdir': os.path.join(str(tmpdir), 'artifacts')
+ 'cachedir': str(tmpdir)
})
result = cli.run(project=project, args=['build', element_name])
assert result.exit_code == 0
@@ -106,27 +109,29 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
# Cache key will be the same however the digest hash will have changed as expected, so reconstruct paths
elementdigest = share2.has_artifact('test', element_name, cache_key)
- buildtreedir = os.path.join(str(tmpdir), 'artifacts', 'extract', 'test', 'autotools-amhello',
+ buildtreedir = os.path.join(str(tmpdir), 'extract', 'test', 'autotools-amhello',
elementdigest.hash, 'buildtree')
assert os.path.isdir(buildtreedir)
assert os.listdir(buildtreedir) is not None
# Delete the local cached artifacts, and assert that when pulled with --pull-buildtrees
# that it was cached in share2 as expected with a populated buildtree dir
- shutil.rmtree(os.path.join(str(tmpdir), 'artifacts'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'cas'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'extract'))
assert cli.get_element_state(project, element_name) != 'cached'
result = cli.run(project=project, args=['--pull-buildtrees', 'artifact', 'pull', element_name])
assert element_name in result.get_pulled_elements()
assert os.path.isdir(buildtreedir)
assert os.listdir(buildtreedir) is not None
- shutil.rmtree(os.path.join(str(tmpdir), 'artifacts'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'cas'))
+ shutil.rmtree(os.path.join(str(tmpdir), 'extract'))
# Clarify that the user config option for cache-buildtrees works as the cli
# main option does. Point to share3 which does not have the artifacts cached to force
# a build
cli.configure({
'artifacts': {'url': share3.repo, 'push': True},
- 'artifactdir': os.path.join(str(tmpdir), 'artifacts'),
+ 'cachedir': str(tmpdir),
'cache': {'cache-buildtrees': 'never'}
})
result = cli.run(project=project, args=['build', element_name])
@@ -134,7 +139,7 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
assert cli.get_element_state(project, element_name) == 'cached'
cache_key = cli.get_element_key(project, element_name)
elementdigest = share3.has_artifact('test', element_name, cache_key)
- buildtreedir = os.path.join(str(tmpdir), 'artifacts', 'extract', 'test', 'autotools-amhello',
+ buildtreedir = os.path.join(str(tmpdir), 'extract', 'test', 'autotools-amhello',
elementdigest.hash, 'buildtree')
assert os.path.isdir(buildtreedir)
assert not os.listdir(buildtreedir)