[ARVADOS] updated: 2.1.0-28-g5a7fdde49

Git user git at public.arvados.org
Thu Oct 22 02:17:01 UTC 2020


Summary of changes:
 .../controllers/container_requests_controller.rb   | 33 ++++++++++++----------
 .../container_requests_controller_test.rb          | 21 +++++++-------
 apps/workbench/test/integration/work_units_test.rb |  4 ++-
 3 files changed, 32 insertions(+), 26 deletions(-)

       via  5a7fdde499ed5baa889a70fb9d1a0aef01eda22b (commit)
      from  2221946b2e7322f9680f5d9617ba98b620158c0d (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 5a7fdde499ed5baa889a70fb9d1a0aef01eda22b
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Oct 21 22:16:26 2020 -0400

    17010: Fix tests.  Tests check that --enable-reuse is set
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/apps/workbench/app/controllers/container_requests_controller.rb b/apps/workbench/app/controllers/container_requests_controller.rb
index c217eb977..62ec3e150 100644
--- a/apps/workbench/app/controllers/container_requests_controller.rb
+++ b/apps/workbench/app/controllers/container_requests_controller.rb
@@ -127,14 +127,12 @@ class ContainerRequestsController < ApplicationController
         @updates[:reuse_steps] = false
       end
       @updates[:command] ||= @object.command
+      @updates[:command] -= ["--disable-reuse", "--enable-reuse"]
       if @updates[:reuse_steps]
-        @updates[:command] = @updates[:command] - ["--disable-reuse"]
-        @updates[:command].insert(1, '--enable-reuse')
+        @updates[:command].insert(1, "--enable-reuse")
       else
-        @updates[:command] -= @updates[:command] - ["--enable-reuse"]
-        @updates[:command].insert(1, '--disable-reuse')
+        @updates[:command].insert(1, "--disable-reuse")
       end
-
       @updates.delete(:reuse_steps)
     end
 
@@ -167,26 +165,31 @@ class ContainerRequestsController < ApplicationController
         if arg.start_with? "--project-uuid="
           command[i] = "--project-uuid=#{@object.owner_uuid}"
         end
-        if arg == "--disable-reuse"
-          command[i] = "--enable-reuse"
-        end
       end
+      command -= ["--disable-reuse", "--enable-reuse"]
+      command.insert(1, '--enable-reuse')
+    end
+
+    if params[:use_existing] == "false"
+      params[:use_existing] = false
+    elsif params[:use_existing] == "true"
+      params[:use_existing] = true
     end
 
-    # By default the copied CR won't be reusing containers, unless use_existing=true
-    # param is passed.
-    if params[:use_existing]
-      @object.use_existing = true
+    if params[:use_existing] || params[:use_existing].nil?
+      # If nil, reuse workflow steps but not the workflow runner.
+      @object.use_existing = (params[:use_existing] ? true : false)
+
       # Pass the correct argument to arvados-cwl-runner command.
       if command[0] == 'arvados-cwl-runner'
-        command = src.command - ['--disable-reuse']
+        command -= ['--disable-reuse']
         command.insert(1, '--enable-reuse')
       end
     else
       @object.use_existing = false
       # Pass the correct argument to arvados-cwl-runner command.
-      if src.command[0] == 'arvados-cwl-runner'
-        command = src.command - ['--enable-reuse']
+      if command[0] == 'arvados-cwl-runner'
+        command -= ['--enable-reuse']
         command.insert(1, '--disable-reuse')
       end
     end
diff --git a/apps/workbench/test/controllers/container_requests_controller_test.rb b/apps/workbench/test/controllers/container_requests_controller_test.rb
index c4a723930..73d357f3a 100644
--- a/apps/workbench/test/controllers/container_requests_controller_test.rb
+++ b/apps/workbench/test/controllers/container_requests_controller_test.rb
@@ -60,17 +60,19 @@ class ContainerRequestsControllerTest < ActionController::TestCase
   end
 
   [
-    ['completed', false, false],
-    ['completed', true, false],
+    ['completed',       false, false],
+    ['completed',        true, false],
+    ['completed',         nil, false],
     ['completed-older', false, true],
-    ['completed-older', true, true],
+    ['completed-older',  true, true],
+    ['completed-older',   nil, true],
   ].each do |cr_fixture, reuse_enabled, uses_acr|
-    test "container request #{uses_acr ? '' : 'not'} using arvados-cwl-runner copy #{reuse_enabled ? 'with' : 'without'} reuse enabled" do
+    test "container request #{uses_acr ? '' : 'not'} using arvados-cwl-runner copy #{reuse_enabled.nil? ? 'nil' : (reuse_enabled ? 'with' : 'without')} reuse enabled" do
       completed_cr = api_fixture('container_requests')[cr_fixture]
       # Set up post request params
       copy_params = {id: completed_cr['uuid']}
-      if reuse_enabled
-        copy_params.merge!({use_existing: true})
+      if !reuse_enabled.nil?
+        copy_params.merge!({use_existing: reuse_enabled})
       end
       post(:copy, params: copy_params, session: session_for(:active))
       assert_response 302
@@ -87,12 +89,11 @@ class ContainerRequestsControllerTest < ActionController::TestCase
       # If the CR's command is arvados-cwl-runner, the appropriate flag should
       # be passed to it
       if uses_acr
-        if reuse_enabled
-          # arvados-cwl-runner's default behavior is to enable reuse
-          assert_includes copied_cr['command'], 'arvados-cwl-runner'
+        assert_equal copied_cr['command'][0], 'arvados-cwl-runner'
+        if reuse_enabled.nil? || reuse_enabled
+          assert_includes copied_cr['command'], '--enable-reuse'
           assert_not_includes copied_cr['command'], '--disable-reuse'
         else
-          assert_includes copied_cr['command'], 'arvados-cwl-runner'
           assert_includes copied_cr['command'], '--disable-reuse'
           assert_not_includes copied_cr['command'], '--enable-reuse'
         end
diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb
index 43740f192..4f2ebbc55 100644
--- a/apps/workbench/test/integration/work_units_test.rb
+++ b/apps/workbench/test/integration/work_units_test.rb
@@ -163,7 +163,9 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest
       assert_text process_txt
       assert_selector 'a', text: template_name
 
-      assert_equal "Set value for ex_string_def", find('div.form-group > div > p.form-control-static > a', text: "hello-testing-123")[:"data-title"]
+      assert_equal "true", find('span[data-name="reuse_steps"]').text
+
+      assert_equal "Set value for ex_string_def", find('div.form-group > div.form-control-static > a', text: "hello-testing-123")[:"data-title"]
 
       page.assert_selector 'a.disabled,button.disabled', text: 'Run'
     end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list