[ARVADOS] updated: 8317b6e41e86f3e5c988906e0a9965479acf7e51
Git user
git at public.curoverse.com
Thu Oct 6 12:54:32 EDT 2016
Summary of changes:
services/api/app/models/container.rb | 17 ++++++++++-------
services/api/test/unit/container_request_test.rb | 8 ++++++--
2 files changed, 16 insertions(+), 9 deletions(-)
via 8317b6e41e86f3e5c988906e0a9965479acf7e51 (commit)
from 929e817fc1c91e1d9a0afcfcab93fe07304d9be5 (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 8317b6e41e86f3e5c988906e0a9965479acf7e51
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Oct 6 12:54:28 2016 -0400
8018: Additional assertions checking when container_uuid changes/does not change.
diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 82eda47..29af223 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -290,13 +290,16 @@ class Container < ArvadosModel
end
if retryable_requests.any?
- c = Container.create!(command: self.command,
- cwd: self.cwd,
- environment: self.environment,
- output_path: self.output_path,
- container_image: self.container_image,
- mounts: self.mounts,
- runtime_constraints: self.runtime_constraints)
+ c_attrs = {
+ command: self.command,
+ cwd: self.cwd,
+ environment: self.environment,
+ output_path: self.output_path,
+ container_image: self.container_image,
+ mounts: self.mounts,
+ runtime_constraints: self.runtime_constraints
+ }
+ c = Container.create! c_attrs
retryable_requests.each do |cr|
cr.with_lock do
# Use row locking because this increments container_count
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index ff9e685..a7578d2 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -436,6 +436,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)
+ prev_container_uuid = cr.container_uuid
c = act_as_system_user do
c = Container.find_by_uuid(cr.container_uuid)
@@ -446,7 +447,8 @@ class ContainerRequestTest < ActiveSupport::TestCase
cr.reload
assert_equal "Committed", cr.state
- old_container_uuid = cr.container_uuid
+ assert_equal prev_container_uuid, cr.container_uuid
+ prev_container_uuid = cr.container_uuid
act_as_system_user do
c.update_attributes!(state: Container::Cancelled)
@@ -454,7 +456,8 @@ class ContainerRequestTest < ActiveSupport::TestCase
cr.reload
assert_equal "Committed", cr.state
- assert_not_equal old_container_uuid, cr.container_uuid
+ assert_not_equal prev_container_uuid, cr.container_uuid
+ prev_container_uuid = cr.container_uuid
c = act_as_system_user do
c = Container.find_by_uuid(cr.container_uuid)
@@ -464,6 +467,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
cr.reload
assert_equal "Final", cr.state
+ assert_equal prev_container_uuid, cr.container_uuid
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list