[ARVADOS] created: da2a4d9c13b80066400161cb7638425828de18d3
Git user
git at public.curoverse.com
Wed Dec 28 12:05:19 EST 2016
at da2a4d9c13b80066400161cb7638425828de18d3 (commit)
commit da2a4d9c13b80066400161cb7638425828de18d3
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Dec 28 12:05:07 2016 -0500
10782: Bugfix, on retry only update container_uuid on container requests
associated with the container in the first place. Update container retry test.
diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 52f1cba..7731a8d 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -341,7 +341,7 @@ class Container < ArvadosModel
act_as_system_user do
if self.state == Cancelled
- retryable_requests = ContainerRequest.where("priority > 0 and state = 'Committed' and container_count < container_count_max")
+ retryable_requests = ContainerRequest.where("container_uuid = ? and priority > 0 and state = 'Committed' and container_count < container_count_max", uuid)
else
retryable_requests = []
end
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index c4d1efe..9e28f7b 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -471,6 +471,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
test "Retry on container cancelled" do
set_user_from_auth :active
cr = create_minimal_req!(priority: 1, state: "Committed", container_count_max: 2)
+ cr2 = create_minimal_req!(priority: 1, state: "Committed", container_count_max: 2, command: ["echo", "baz"])
prev_container_uuid = cr.container_uuid
c = act_as_system_user do
@@ -481,8 +482,10 @@ class ContainerRequestTest < ActiveSupport::TestCase
end
cr.reload
+ cr2.reload
assert_equal "Committed", cr.state
assert_equal prev_container_uuid, cr.container_uuid
+ assert_not_equal cr2.container_uuid, cr.container_uuid
prev_container_uuid = cr.container_uuid
act_as_system_user do
@@ -490,8 +493,10 @@ class ContainerRequestTest < ActiveSupport::TestCase
end
cr.reload
+ cr2.reload
assert_equal "Committed", cr.state
assert_not_equal prev_container_uuid, cr.container_uuid
+ assert_not_equal cr2.container_uuid, cr.container_uuid
prev_container_uuid = cr.container_uuid
c = act_as_system_user do
@@ -501,8 +506,10 @@ class ContainerRequestTest < ActiveSupport::TestCase
end
cr.reload
+ cr2.reload
assert_equal "Final", cr.state
assert_equal prev_container_uuid, cr.container_uuid
+ assert_not_equal cr2.container_uuid, cr.container_uuid
end
test "Finalize committed request when reusing a finished container" do
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list