[ARVADOS] created: 2.1.0-619-gfdfa3253c

Git user git at public.arvados.org
Thu Apr 1 14:08:46 UTC 2021


        at  fdfa3253c0da07a80a21c84c58a18c3a49a9220a (commit)


commit fdfa3253c0da07a80a21c84c58a18c3a49a9220a
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Apr 1 11:05:20 2021 -0300

    17508: Fixes unit test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/sdk/python/tests/test_arv_keepdocker.py b/sdk/python/tests/test_arv_keepdocker.py
index 53da6cc74..fd3a69cae 100644
--- a/sdk/python/tests/test_arv_keepdocker.py
+++ b/sdk/python/tests/test_arv_keepdocker.py
@@ -5,6 +5,7 @@
 from __future__ import absolute_import
 import arvados
 import collections
+import copy
 import hashlib
 import mock
 import os
@@ -184,7 +185,7 @@ class ArvKeepdockerTestCase(unittest.TestCase, tutil.VersionChecker):
              self.assertRaises(StopTest):
 
             api()._rootDesc = fakeDD
-            api().collections().get().execute.return_value = mocked_collection
+            api().collections().get().execute.return_value = copy.deepcopy(mocked_collection)
             api().collections().update().execute.side_effect = StopTest
             self.run_arv_keepdocker(['--force', 'testimage'], err)
 

commit 9d7e070f2a518b4da0174140fb6e3914b32efba1
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Mar 31 17:32:03 2021 -0300

    17508: Fixes arv-keepdocker bug.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/sdk/python/arvados/commands/keepdocker.py b/sdk/python/arvados/commands/keepdocker.py
index 6673888ab..8eb9dd75a 100644
--- a/sdk/python/arvados/commands/keepdocker.py
+++ b/sdk/python/arvados/commands/keepdocker.py
@@ -505,7 +505,11 @@ def main(arguments=None, stdout=sys.stdout, install_sig_handlers=True, api=None)
             put_args + ['--filename', outfile_name, image_file.name], stdout=stdout,
             install_sig_handlers=install_sig_handlers).strip()
 
-        api.collections().update(uuid=coll_uuid, body={"properties": {"docker-image-repo-tag": image_repo_tag}}).execute(num_retries=args.retries)
+        # Managed properties could be already set
+        coll_properties = api.collections().get(uuid=coll_uuid).execute(num_retries=args.retries).get('properties', {})
+        coll_properties.update({"docker-image-repo-tag": image_repo_tag})
+
+        api.collections().update(uuid=coll_uuid, body={"properties": coll_properties}).execute(num_retries=args.retries)
 
         # Read the image metadata and make Arvados links from it.
         image_file.seek(0)

commit 9233b8e5357e72c8817eebc9f4e3d08006e52c77
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Mar 31 19:05:51 2021 -0300

    17508: Exposes bug with a test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/sdk/python/tests/test_arv_keepdocker.py b/sdk/python/tests/test_arv_keepdocker.py
index 695a0389d..53da6cc74 100644
--- a/sdk/python/tests/test_arv_keepdocker.py
+++ b/sdk/python/tests/test_arv_keepdocker.py
@@ -4,6 +4,7 @@
 
 from __future__ import absolute_import
 import arvados
+import collections
 import hashlib
 import mock
 import os
@@ -149,3 +150,46 @@ class ArvKeepdockerTestCase(unittest.TestCase, tutil.VersionChecker):
                         side_effect=StopTest) as find_image_mock:
             self.run_arv_keepdocker(['[::1]/repo/img'], sys.stderr)
         find_image_mock.assert_called_with('[::1]/repo/img', 'latest')
+
+    @mock.patch('arvados.commands.keepdocker.find_image_hashes',
+                return_value=['abc123'])
+    @mock.patch('arvados.commands.keepdocker.find_one_image_hash',
+                return_value='abc123')
+    def test_collection_property_update(self, _1, _2):
+        image_id = 'sha256:'+hashlib.sha256(b'image').hexdigest()
+        fakeDD = arvados.api('v1')._rootDesc
+        fakeDD['dockerImageFormats'] = ['v2']
+
+        err = tutil.StringIO()
+        out = tutil.StringIO()
+        File = collections.namedtuple('File', ['name'])
+        mocked_file = File(name='docker_image')
+        mocked_collection = {
+            'uuid': 'new-collection-uuid',
+            'properties': {
+                'responsible_person_uuid': 'person_uuid',
+            }
+        }
+
+        with tutil.redirected_streams(stdout=out), \
+             mock.patch('arvados.api') as api, \
+             mock.patch('arvados.commands.keepdocker.popen_docker',
+                        return_value=subprocess.Popen(
+                            ['echo', image_id],
+                            stdout=subprocess.PIPE)), \
+             mock.patch('arvados.commands.keepdocker.prep_image_file',
+                        return_value=(mocked_file, False)), \
+             mock.patch('arvados.commands.put.main',
+                        return_value='new-collection-uuid'), \
+             self.assertRaises(StopTest):
+
+            api()._rootDesc = fakeDD
+            api().collections().get().execute.return_value = mocked_collection
+            api().collections().update().execute.side_effect = StopTest
+            self.run_arv_keepdocker(['--force', 'testimage'], err)
+
+        updated_properties = mocked_collection['properties']
+        updated_properties.update({'docker-image-repo-tag': 'testimage:latest'})
+        api().collections().update.assert_called_with(
+            uuid=mocked_collection['uuid'],
+            body={'properties': updated_properties})

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list