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
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)
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)
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)
cr.reload
assert_equal "Final", cr.state
+ assert_equal prev_container_uuid, cr.container_uuid
end
end