Merge branch '15554-crunchstat-summary-live-log-no-sdk'
[arvados.git] / services / api / test / unit / container_request_test.rb
index 0dad6ee75ccf64b6484bf8da202b780932ff7a95..b04bae8647a2417d227e84a793043d1207f875cc 100644 (file)
@@ -515,7 +515,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   test "Container.resolve_container_image(pdh)" do
     set_user_from_auth :active
     [[:docker_image, 'v1'], [:docker_image_1_12, 'v2']].each do |coll, ver|
-      Rails.configuration.Containers.SupportedDockerImageFormats = [ver]
+      Rails.configuration.Containers.SupportedDockerImageFormats = {ver=>{}}
       pdh = collections(coll).portable_data_hash
       resolved = Container.resolve_container_image(pdh)
       assert_equal resolved, pdh
@@ -541,7 +541,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "migrated docker image" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
     add_docker19_migration_link
 
     # Test that it returns only v2 images even though request is for v1 image.
@@ -559,7 +559,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "use unmigrated docker image" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v1']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
     add_docker19_migration_link
 
     # Test that it returns only supported v1 images even though there is a
@@ -578,7 +578,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "incompatible docker image v1" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v1']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
     add_docker19_migration_link
 
     # Don't return unsupported v2 image even if we ask for it directly.
@@ -591,7 +591,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "incompatible docker image v2" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = ['v2']
+    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
     # No migration link, don't return unsupported v1 image,
 
     set_user_from_auth :active
@@ -630,6 +630,8 @@ class ContainerRequestTest < ActiveSupport::TestCase
       set_user_from_auth :active
       cr1 = create_minimal_req!(common_attrs.merge({state: ContainerRequest::Committed,
                                                     environment: env1}))
+      run_container(cr1)
+      cr1.reload
       if use_existing.nil?
         # Testing with use_existing default value
         cr2 = create_minimal_req!(common_attrs.merge({state: ContainerRequest::Uncommitted,
@@ -837,7 +839,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
     assert_not_nil(trash)
     assert_not_nil(delete)
     assert_in_delta(trash, now + 1.second, 10)
-    assert_in_delta(delete, now + Rails.configuration.Collections.BlobSigningTTL.second, 10)
+    assert_in_delta(delete, now + Rails.configuration.Collections.BlobSigningTTL, 10)
   end
 
   def check_output_ttl_1y(now, trash, delete)
@@ -850,13 +852,18 @@ class ContainerRequestTest < ActiveSupport::TestCase
 
   def run_container(cr)
     act_as_system_user do
+      logc = Collection.new(owner_uuid: system_user_uuid,
+                            manifest_text: ". ef772b2f28e2c8ca84de45466ed19ee9+7815 0:0:arv-mount.txt\n")
+      logc.save!
+
       c = Container.find_by_uuid(cr.container_uuid)
       c.update_attributes!(state: Container::Locked)
       c.update_attributes!(state: Container::Running)
       c.update_attributes!(state: Container::Complete,
                            exit_code: 0,
                            output: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45',
-                           log: 'fa7aeb5140e2848d39b416daeef4ffc5+45')
+                           log: logc.portable_data_hash)
+      logc.destroy
       c
     end
   end