You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/18 07:00:48 UTC

[buildstream] 01/02: tests: Refactor pull.py / push.py tests to not use deprecated methods

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/artifact-cache-refactor
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 992d610cb275318409d95a7c7485c4d3ab140d81
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu Aug 18 15:57:55 2022 +0900

    tests: Refactor pull.py / push.py tests to not use deprecated methods
    
    As per issue #781, these functions are meant to be removed.
---
 tests/artifactcache/pull.py | 8 ++++++--
 tests/artifactcache/push.py | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py
index e54ba5124..5c3c06665 100644
--- a/tests/artifactcache/pull.py
+++ b/tests/artifactcache/pull.py
@@ -171,7 +171,9 @@ def test_pull_tree(cli, tmpdir, datafiles):
             tree_maker(cas, tree, directory)
 
             # Push the Tree as a regular message
-            tree_digest = artifactcache.push_message(project, tree)
+            _, remotes = artifactcache.get_remotes(project.name, True)
+            assert len(remotes) == 1
+            tree_digest = remotes[0].push_message(tree)
             tree_hash, tree_size = tree_digest.hash, tree_digest.size_bytes
             assert tree_hash and tree_size
 
@@ -187,7 +189,9 @@ def test_pull_tree(cli, tmpdir, datafiles):
             tree_digest = remote_execution_pb2.Digest(hash=tree_hash, size_bytes=tree_size)
 
             # Pull the artifact using the Tree object
-            directory_digest = artifactcache.pull_tree(project, artifact_digest)
+            _, remotes = artifactcache.get_remotes(project.name, False)
+            assert len(remotes) == 1
+            directory_digest = cas.pull_tree(remotes[0], tree_digest)
             directory_hash, directory_size = directory_digest.hash, directory_digest.size_bytes
 
         # Directory size now zero with AaaP and stack element commit #1cbc5e63dc
diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py
index 8af03838e..4748b5831 100644
--- a/tests/artifactcache/push.py
+++ b/tests/artifactcache/push.py
@@ -164,7 +164,9 @@ def test_push_message(tmpdir, datafiles):
             )
 
             # Push the message object
-            command_digest = artifactcache.push_message(project, command)
+            _, remotes = artifactcache.get_remotes(project.name, True)
+            assert len(remotes) == 1
+            command_digest = remotes[0].push_message(command)
             message_hash, message_size = command_digest.hash, command_digest.size_bytes
 
         assert message_hash and message_size