20877: Do not create log or output collections if parent is frozen or trashed
[arvados.git] / services / api / test / unit / container_request_test.rb
index 71cb9d7301bc4313e69c23091b1f318fbff3dc86..a64adba6ff19c3619f1f56c503551161b6735aa9 100644 (file)
@@ -1498,6 +1498,22 @@ class ContainerRequestTest < ActiveSupport::TestCase
       # the cr's container now has priority of 0
       c.reload
       assert_equal 0, c.priority
+
+      assert_equal c.state, 'Running'
+      assert_equal cr.state, 'Committed'
+
+      # mark the container as cancelled, this should cause the
+      # container request to go to final state and run the finalize
+      # function
+      act_as_system_user do
+        c.update_attributes!(state: 'Cancelled', log: 'fa7aeb5140e2848d39b416daeef4ffc5+45')
+      end
+      c.reload
+      cr.reload
+
+      assert_equal c.state, 'Cancelled'
+      assert_equal cr.state, 'Final'
+      assert_equal nil, cr.log_uuid
     end
   end