[ARVADOS] updated: 1.2.0-314-g467250f94

Git user git at public.curoverse.com
Wed Nov 7 12:50:39 EST 2018


Summary of changes:
 services/api/app/models/container.rb             | 22 +++-------------------
 services/api/test/unit/container_request_test.rb | 23 ++++++++++-------------
 2 files changed, 13 insertions(+), 32 deletions(-)

       via  467250f944acb5699f372b2715e3d78b3d413261 (commit)
      from  d8a9500ef903c96ea46bf2a2932fc30389ad46dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 467250f944acb5699f372b2715e3d78b3d413261
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Wed Nov 7 14:48:31 2018 -0300

    14323: Lookup collection mount by uuid when pdh is not given. Update tests.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 6ef9d7cbd..38c4ba6c7 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -224,26 +224,10 @@ class Container < ArvadosModel
         next
       end
 
-      pdh = mount['portable_data_hash']
-      uuid = mount['uuid']
+      uuid = mount.delete 'uuid'
 
-      # Prioritize PDH over UUID for mount selection
-      if not pdh.nil?
-        c = Collection.
-          readable_by(current_user).
-          where(portable_data_hash: pdh)
-        if c.count > 0
-          if uuid && c.where(uuid: uuid).count == 0
-            raise ArgumentError.new "cannot mount collection #{uuid.inspect}: current portable_data_hash #{pdh.inspect} does not match #{c.first.portable_data_hash.inspect} in request"
-          end
-          # mount.delete 'uuid'
-          next
-        end
-        raise ArgumentError.new "cannot mount collection #{pdh.inspect}: not found"
-      end
-
-      # PDH not supplied, try by UUID
-      if uuid
+      if mount['portable_data_hash'].nil?
+        # PDH not supplied, try by UUID
         c = Collection.
           readable_by(current_user).
           where(uuid: uuid).
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index f98a64cd7..06c36e6c4 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -425,7 +425,6 @@ class ContainerRequestTest < ActiveSupport::TestCase
     lambda do |resolved|
       resolved["/out"] == {
         "portable_data_hash" => "1f4b0bc7583c2a7f9102c395f4ffc5e3+45",
-        "uuid" => "zzzzz-4zz18-znfnqtbbv4spc3w",
         "kind" => "collection",
         "path" => "/foo",
       }
@@ -438,22 +437,21 @@ class ContainerRequestTest < ActiveSupport::TestCase
     lambda do |resolved|
       resolved["/out"] == {
         "portable_data_hash" => "1f4b0bc7583c2a7f9102c395f4ffc5e3+45",
-        "uuid" => "zzzzz-4zz18-znfnqtbbv4spc3w",
         "kind" => "collection",
         "path" => "/foo",
       }
     end],
-    [{"/out" => {
+   [{"/out" => {
       "kind" => "collection",
       "portable_data_hash" => "1f4b0bc7583c2a7f9102c395f4ffc5e3+45",
       "path" => "/foo"}},
-  lambda do |resolved|
-    resolved["/out"] == {
-      "portable_data_hash" => "1f4b0bc7583c2a7f9102c395f4ffc5e3+45",
-      "kind" => "collection",
-      "path" => "/foo",
-    }
-  end],
+    lambda do |resolved|
+      resolved["/out"] == {
+        "portable_data_hash" => "1f4b0bc7583c2a7f9102c395f4ffc5e3+45",
+        "kind" => "collection",
+        "path" => "/foo",
+      }
+    end],
 ].each do |mounts, okfunc|
     test "resolve mounts #{mounts.inspect} to values" do
       set_user_from_auth :active
@@ -487,9 +485,8 @@ class ContainerRequestTest < ActiveSupport::TestCase
         "path" => "/foo",
       },
     }
-    assert_raises(ArgumentError) do
-      Container.resolve_mounts(m)
-    end
+    resolved_mounts = Container.resolve_mounts(m)
+    assert_equal m['portable_data_hash'], resolved_mounts['portable_data_hash']
   end
 
   ['arvados/apitestfixture:latest',

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list