[ARVADOS] updated: e1e0bec5d9828fff1b9269322d415789675e6fab

Git user git at public.curoverse.com
Fri Mar 10 14:06:25 EST 2017


Summary of changes:
 services/api/test/unit/container_request_test.rb | 51 ++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

       via  e1e0bec5d9828fff1b9269322d415789675e6fab (commit)
      from  f4a7c5e6b1e6e30ad8a31a704642fcc360239e03 (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 e1e0bec5d9828fff1b9269322d415789675e6fab
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Mar 10 14:06:22 2017 -0500

    8567: Add & tweak tests for selecting compatible Docker image format.

diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 328273b..8935170 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -420,6 +420,8 @@ class ContainerRequestTest < ActiveSupport::TestCase
     Rails.configuration.docker_image_formats = ['v2']
     add_docker19_migration_link
 
+    # Test that it returns only v2 images even though request is for v1 image.
+
     set_user_from_auth :active
     cr = create_minimal_req!(command: ["true", "1"],
                              container_image: collections(:docker_image).portable_data_hash)
@@ -432,6 +434,55 @@ class ContainerRequestTest < ActiveSupport::TestCase
                  collections(:docker_image_1_12).portable_data_hash)
   end
 
+  test "use unmigrated docker image" do
+    Rails.configuration.docker_image_formats = ['v1']
+    add_docker19_migration_link
+
+    # Test that it returns only supported v1 images even though there is a
+    # migration link.
+
+    set_user_from_auth :active
+    cr = create_minimal_req!(command: ["true", "1"],
+                             container_image: collections(:docker_image).portable_data_hash)
+    assert_equal(cr.send(:container_image_for_container),
+                 collections(:docker_image).portable_data_hash)
+
+    cr = create_minimal_req!(command: ["true", "2"],
+                             container_image: links(:docker_image_collection_tag).name)
+    assert_equal(cr.send(:container_image_for_container),
+                 collections(:docker_image).portable_data_hash)
+  end
+
+  test "incompatible docker image v1" do
+    Rails.configuration.docker_image_formats = ['v1']
+    add_docker19_migration_link
+
+    # Don't return unsupported v2 image even if we ask for it directly.
+    set_user_from_auth :active
+    cr = create_minimal_req!(command: ["true", "1"],
+                             container_image: collections(:docker_image_1_12).portable_data_hash)
+    assert_raises(ArvadosModel::UnresolvableContainerError) do
+      cr.send(:container_image_for_container)
+    end
+  end
+
+  test "incompatible docker image v2" do
+    Rails.configuration.docker_image_formats = ['v2']
+    # No migration link, don't return unsupported v1 image,
+
+    set_user_from_auth :active
+    cr = create_minimal_req!(command: ["true", "1"],
+                             container_image: collections(:docker_image).portable_data_hash)
+    assert_raises(ArvadosModel::UnresolvableContainerError) do
+      cr.send(:container_image_for_container)
+    end
+    cr = create_minimal_req!(command: ["true", "2"],
+                             container_image: links(:docker_image_collection_tag).name)
+    assert_raises(ArvadosModel::UnresolvableContainerError) do
+      cr.send(:container_image_for_container)
+    end
+  end
+
   test "requestor can retrieve container owned by dispatch" do
     assert_not_empty Container.readable_by(users(:admin)).where(uuid: containers(:running).uuid)
     assert_not_empty Container.readable_by(users(:active)).where(uuid: containers(:running).uuid)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list