summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2019-09-05 12:47:15 +0100
committerTristan Maat <tristan.maat@codethink.co.uk>2019-09-06 12:26:17 +0100
commit77db59dc6f5c95d54e7b58b8789b7a399a22e1ab (patch)
tree98b34885984452a07d23008dbf578ec990e2d18f
parent2de79490ca5d55cac35580f172454f577b758abd (diff)
downloadbuildstream-tlater/cache-endpoints.tar.gz
Change unfitting function nametlater/cache-endpoints
-rw-r--r--tests/artifactcache/pull.py4
-rw-r--r--tests/artifactcache/push.py2
-rw-r--r--tests/frontend/artifact_delete.py2
-rw-r--r--tests/frontend/artifact_show.py2
-rw-r--r--tests/frontend/push.py2
-rw-r--r--tests/integration/artifact.py6
-rw-r--r--tests/integration/cachedfail.py2
-rw-r--r--tests/integration/pullbuildtrees.py10
-rw-r--r--tests/integration/shellbuildtrees.py2
-rw-r--r--tests/testutils/artifactshare.py8
10 files changed, 20 insertions, 20 deletions
diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py
index 71db3e338..2e33af3ac 100644
--- a/tests/artifactcache/pull.py
+++ b/tests/artifactcache/pull.py
@@ -66,7 +66,7 @@ def test_pull(cli, tmpdir, datafiles):
# Assert that we are now cached locally
assert cli.get_element_state(project_dir, 'target.bst') == 'cached'
# Assert that we shared/pushed the cached artifact
- assert share.has_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst'))
+ assert share.get_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst'))
# Delete the artifact locally
cli.remove_artifact_from_cache(project_dir, 'target.bst')
@@ -138,7 +138,7 @@ def test_pull_tree(cli, tmpdir, datafiles):
# Assert that we are now cached locally
assert cli.get_element_state(project_dir, 'target.bst') == 'cached'
# Assert that we shared/pushed the cached artifact
- assert share.has_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst'))
+ assert share.get_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst'))
with dummy_context(config=user_config_file) as context:
# Load the project and CAS cache
diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py
index 364ac39f0..8b00d0fb7 100644
--- a/tests/artifactcache/push.py
+++ b/tests/artifactcache/push.py
@@ -84,7 +84,7 @@ def test_push(cli, tmpdir, datafiles):
# Write down the user configuration file
_yaml.roundtrip_dump(user_config, file=user_config_file)
element_key = _push(cli, rootcache_dir, project_dir, user_config_file, 'target.bst')
- assert share.has_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst', cache_key=element_key))
+ assert share.get_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst', cache_key=element_key))
@pytest.mark.in_subprocess
diff --git a/tests/frontend/artifact_delete.py b/tests/frontend/artifact_delete.py
index 80870c81a..a9f5ec6da 100644
--- a/tests/frontend/artifact_delete.py
+++ b/tests/frontend/artifact_delete.py
@@ -159,7 +159,7 @@ def test_artifact_delete_pulled_artifact_without_buildtree(cli, tmpdir, datafile
result.assert_success()
# Make sure it's in the share
- assert remote.has_artifact(cli.get_artifact_name(project, 'test', element))
+ assert remote.get_artifact(cli.get_artifact_name(project, 'test', element))
# Delete and then pull the artifact (without its buildtree)
result = cli.run(project=project, args=['artifact', 'delete', element])
diff --git a/tests/frontend/artifact_show.py b/tests/frontend/artifact_show.py
index 913dde9c8..76ea93d63 100644
--- a/tests/frontend/artifact_show.py
+++ b/tests/frontend/artifact_show.py
@@ -124,7 +124,7 @@ def test_artifact_show_element_available_remotely(cli, tmpdir, datafiles):
result.assert_success()
# Make sure it's in the share
- assert remote.has_artifact(cli.get_artifact_name(project, 'test', element))
+ assert remote.get_artifact(cli.get_artifact_name(project, 'test', element))
# Delete the artifact from the local cache
result = cli.run(project=project, args=['artifact', 'delete', element])
diff --git a/tests/frontend/push.py b/tests/frontend/push.py
index 57e670fe6..31f96cbdf 100644
--- a/tests/frontend/push.py
+++ b/tests/frontend/push.py
@@ -569,7 +569,7 @@ def test_push_cross_junction(cli, tmpdir, datafiles):
cli.run(project=project, args=['artifact', 'push', 'junction.bst:import-etc.bst'])
cache_key = cli.get_element_key(project, 'junction.bst:import-etc.bst')
- assert share.has_artifact(cli.get_artifact_name(project, 'subtest', 'import-etc.bst', cache_key=cache_key))
+ assert share.get_artifact(cli.get_artifact_name(project, 'subtest', 'import-etc.bst', cache_key=cache_key))
@pytest.mark.datafiles(DATA_DIR)
diff --git a/tests/integration/artifact.py b/tests/integration/artifact.py
index 4180bf6fd..59b7bfaad 100644
--- a/tests/integration/artifact.py
+++ b/tests/integration/artifact.py
@@ -70,12 +70,12 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
result = cli.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(cli.get_artifact_name(project, 'test', element_name))
+ assert share1.get_artifact(cli.get_artifact_name(project, 'test', element_name))
# The buildtree dir should not exist, as we set the config to not cache buildtrees.
artifact_name = cli.get_artifact_name(project, 'test', element_name)
- assert share1.has_artifact(artifact_name)
+ assert share1.get_artifact(artifact_name)
with cli.artifact.extract_buildtree(cwd, cwd, artifact_name) as buildtreedir:
assert not buildtreedir
@@ -111,7 +111,7 @@ def test_cache_buildtrees(cli, tmpdir, datafiles):
result = cli.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name])
assert result.exit_code == 0
assert cli.get_element_state(project, element_name) == 'cached'
- assert share2.has_artifact(cli.get_artifact_name(project, 'test', element_name))
+ assert share2.get_artifact(cli.get_artifact_name(project, 'test', element_name))
# Cache key will be the same however the digest hash will have changed as expected, so reconstruct paths
with cli.artifact.extract_buildtree(cwd, cwd, artifact_name) as buildtreedir:
diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py
index f8dd52aa6..08733ab71 100644
--- a/tests/integration/cachedfail.py
+++ b/tests/integration/cachedfail.py
@@ -180,7 +180,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error):
# 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(cli.get_artifact_name(project, 'test', 'element.bst'))
+ assert share.get_artifact(cli.get_artifact_name(project, 'test', 'element.bst'))
@pytest.mark.skipif(HAVE_SANDBOX != 'bwrap', reason='Only available with bubblewrap on Linux')
diff --git a/tests/integration/pullbuildtrees.py b/tests/integration/pullbuildtrees.py
index af9186b1b..4251aa6d0 100644
--- a/tests/integration/pullbuildtrees.py
+++ b/tests/integration/pullbuildtrees.py
@@ -56,7 +56,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles):
result = cli2.run(project=project, args=['build', element_name])
assert result.exit_code == 0
assert cli2.get_element_state(project, element_name) == 'cached'
- assert share1.has_artifact(cli2.get_artifact_name(project, 'test', element_name))
+ assert share1.get_artifact(cli2.get_artifact_name(project, 'test', element_name))
default_state(cli2, tmpdir, share1)
# Pull artifact with default config, assert that pulling again
@@ -116,7 +116,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles):
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(cli2.get_artifact_name(project, 'test', element_name))
+ assert not share2.get_artifact(cli2.get_artifact_name(project, 'test', 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
@@ -127,7 +127,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles):
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(cli2.get_artifact_name(project, 'test', element_name))
+ assert share2.get_artifact(cli2.get_artifact_name(project, 'test', element_name))
default_state(cli2, tmpdir, share1)
# Assert that bst artifact push will automatically attempt to pull a missing buildtree
@@ -143,7 +143,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles):
with cli2.artifact.extract_buildtree(cwd, cwd, artifact_name) as buildtreedir:
assert not buildtreedir
assert element_name not in result.get_pushed_elements()
- assert not share3.has_artifact(cli2.get_artifact_name(project, 'test', element_name))
+ assert not share3.get_artifact(cli2.get_artifact_name(project, 'test', element_name))
# Assert that if we add an extra remote that has the buildtree artfact cached, bst artifact push will
# automatically attempt to pull it and will be successful, leading to the full artifact being pushed
@@ -156,7 +156,7 @@ def test_pullbuildtrees(cli2, tmpdir, datafiles):
with cli2.artifact.extract_buildtree(cwd, cwd, artifact_name) as buildtreedir:
assert os.path.isdir(buildtreedir)
assert element_name in result.get_pushed_elements()
- assert share3.has_artifact(cli2.get_artifact_name(project, 'test', element_name))
+ assert share3.get_artifact(cli2.get_artifact_name(project, 'test', element_name))
# Ensure that only valid pull-buildtrees boolean options make it through the loading
diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py
index 81a279479..146bc6062 100644
--- a/tests/integration/shellbuildtrees.py
+++ b/tests/integration/shellbuildtrees.py
@@ -239,7 +239,7 @@ def test_buildtree_options(cli, tmpdir, datafiles):
result = cli.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name])
result.assert_success()
assert cli.get_element_state(project, element_name) == 'cached'
- assert share.has_artifact(cli.get_artifact_name(project, 'test', element_name))
+ assert share.get_artifact(cli.get_artifact_name(project, 'test', element_name))
# Discard the cache
shutil.rmtree(str(os.path.join(str(tmpdir), 'cache', 'cas')))
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index e20f6e694..f883b3d59 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -157,8 +157,8 @@ class ArtifactShare():
# artifact_name (str): The composed complete artifact name
#
# Returns:
- # (str): artifact digest if the artifact exists in the share, otherwise None.
- def has_artifact(self, artifact_name):
+ # (ArtifactProto): artifact digest if the artifact exists in the share, otherwise None.
+ def get_artifact(self, artifact_name):
artifact_proto = self.get_artifact_proto(artifact_name)
if not artifact_proto:
return None
@@ -208,7 +208,7 @@ statvfs_result = namedtuple('statvfs_result', 'f_blocks f_bfree f_bsize f_bavail
# Assert that a given artifact is in the share
#
def assert_shared(cli, share, project, element_name, *, project_name='test'):
- if not share.has_artifact(cli.get_artifact_name(project, project_name, element_name)):
+ if not share.get_artifact(cli.get_artifact_name(project, project_name, element_name)):
raise AssertionError("Artifact share at {} does not contain the expected element {}"
.format(share.repo, element_name))
@@ -216,6 +216,6 @@ def assert_shared(cli, share, project, element_name, *, project_name='test'):
# Assert that a given artifact is not in the share
#
def assert_not_shared(cli, share, project, element_name, *, project_name='test'):
- if share.has_artifact(cli.get_artifact_name(project, project_name, element_name)):
+ if share.get_artifact(cli.get_artifact_name(project, project_name, element_name)):
raise AssertionError("Artifact share at {} unexpectedly contains the element {}"
.format(share.repo, element_name))