From: Lucas Di Pentima Date: Wed, 26 Apr 2017 14:03:35 +0000 (-0300) Subject: 11185: On re-run without reuse, assign 'false' to CR.use_existing. Added related... X-Git-Tag: 1.1.0~277^2~5 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/fed8ee006cdfc2029f287c656b184f3ce7507847 11185: On re-run without reuse, assign 'false' to CR.use_existing. Added related test. --- diff --git a/apps/workbench/app/controllers/container_requests_controller.rb b/apps/workbench/app/controllers/container_requests_controller.rb index 75bcebd63f..36bda087f8 100644 --- a/apps/workbench/app/controllers/container_requests_controller.rb +++ b/apps/workbench/app/controllers/container_requests_controller.rb @@ -64,10 +64,13 @@ class ContainerRequestsController < ApplicationController @object = ContainerRequest.new - # If "no reuse" requested, pass the correct argument to arvados-cwl-runner command. - if params[:no_reuse] and src.command[0] == 'arvados-cwl-runner' - command = src.command - ['--enable-reuse'] - command.insert(1, '--disable-reuse') + if params[:no_reuse] + @object.use_existing = false + # If "no reuse" requested, pass the correct argument to arvados-cwl-runner command. + if src.command[0] == 'arvados-cwl-runner' + command = src.command - ['--enable-reuse'] + command.insert(1, '--disable-reuse') + end else command = src.command end diff --git a/apps/workbench/test/controllers/container_requests_controller_test.rb b/apps/workbench/test/controllers/container_requests_controller_test.rb index 6a0dd30445..af7abcd3b2 100644 --- a/apps/workbench/test/controllers/container_requests_controller_test.rb +++ b/apps/workbench/test/controllers/container_requests_controller_test.rb @@ -57,4 +57,13 @@ class ContainerRequestsControllerTest < ActionController::TestCase assert_equal completed_cr['cmd'], copied_cr['cmd'] assert_equal completed_cr['runtime_constraints']['ram'], copied_cr['runtime_constraints'][:ram] end + + test "container request copy without reuse" do + completed_cr = api_fixture('container_requests')['completed'] + post(:copy, {id: completed_cr['uuid']}, session_for(:active)) + assert_response 302 + copied_cr = assigns(:object) + assert_not_nil copied_cr + refute copied_cr['use_existing'] + end end