[ARVADOS] updated: 25919f35ed49a1121dafb57b14b591420b280e91

Git user git at public.curoverse.com
Wed Jul 13 13:11:46 EDT 2016


Summary of changes:
 ...sses_controller.rb => work_units_controller.rb} |  2 +-
 .../{all_processes => work_units}/index.html.erb   |  0
 apps/workbench/config/routes.rb                    |  2 +-
 .../work_units_controller_test.rb}                 | 61 ++++++++--------------
 apps/workbench/test/integration/work_units_test.rb | 58 ++++++++++++++++++++
 5 files changed, 83 insertions(+), 40 deletions(-)
 rename apps/workbench/app/controllers/{all_processes_controller.rb => work_units_controller.rb} (97%)
 rename apps/workbench/app/views/{all_processes => work_units}/index.html.erb (100%)
 rename apps/workbench/test/{integration/all_processes_test.rb => controllers/work_units_controller_test.rb} (56%)
 create mode 100644 apps/workbench/test/integration/work_units_test.rb

       via  25919f35ed49a1121dafb57b14b591420b280e91 (commit)
      from  b2b5b792d3713ab3987a621edf98b3b312f1d4e4 (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 25919f35ed49a1121dafb57b14b591420b280e91
Author: radhika <radhika at curoverse.com>
Date:   Wed Jul 13 13:10:58 2016 -0400

    9319: rename all_processes_controller as work_units_controller

diff --git a/apps/workbench/app/controllers/all_processes_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
similarity index 97%
rename from apps/workbench/app/controllers/all_processes_controller.rb
rename to apps/workbench/app/controllers/work_units_controller.rb
index 0837e31..6ed9482 100644
--- a/apps/workbench/app/controllers/all_processes_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -1,4 +1,4 @@
-class AllProcessesController < ApplicationController
+class WorkUnitsController < ApplicationController
   def render_index
     respond_to do |f|
       f.json {
diff --git a/apps/workbench/app/views/all_processes/index.html.erb b/apps/workbench/app/views/work_units/index.html.erb
similarity index 100%
rename from apps/workbench/app/views/all_processes/index.html.erb
rename to apps/workbench/app/views/work_units/index.html.erb
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index d12c922..3a756e9 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -13,7 +13,7 @@ ArvadosWorkbench::Application.routes.draw do
   get "report_issue_popup" => 'actions#report_issue_popup', :as => :report_issue_popup
   post "report_issue" => 'actions#report_issue', :as => :report_issue
   get "star" => 'actions#star', :as => :star
-  get "all_processes" => 'all_processes#index', :as => :all_processes
+  get "all_processes" => 'work_units#index', :as => :all_processes
   resources :nodes
   resources :humans
   resources :traits
diff --git a/apps/workbench/test/integration/all_processes_test.rb b/apps/workbench/test/controllers/work_units_controller_test.rb
similarity index 56%
rename from apps/workbench/test/integration/all_processes_test.rb
rename to apps/workbench/test/controllers/work_units_controller_test.rb
index e2999d8..12e0271 100644
--- a/apps/workbench/test/integration/all_processes_test.rb
+++ b/apps/workbench/test/controllers/work_units_controller_test.rb
@@ -1,20 +1,12 @@
-require 'integration_helper'
+require 'test_helper'
 
-class AllProcessesTest < ActionDispatch::IntegrationTest
-  setup do
-    need_javascript
-  end
+class WorkUnitsControllerTest < ActionController::TestCase
+  # These tests don't do state-changing API calls.
+  # Save some time by skipping the database reset.
+  reset_api_fixtures :after_each_test, false
+  reset_api_fixtures :after_suite, true
 
   [
-    [nil, 25, 100,
-      ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
-       '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
-       '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7',
-       '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
-       '/container_requests/zzzzz-xvhdp-cr4completedcr2',
-       '/container_requests/zzzzz-xvhdp-cr4requestercn2'],
-      ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l',
-       '/container_requests/zzzzz-xvhdp-oneof60crs00001']],
     ['foo', 10, 25,
       ['/pipeline_instances/zzzzz-d1hrv-1xfj6xkicf2muk2',
        '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
@@ -35,33 +27,15 @@ class AllProcessesTest < ActionDispatch::IntegrationTest
        '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
        '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
   ].each do |search_filter, expected_min, expected_max, expected, not_expected|
-    test "scroll all_processes page for search filter '#{search_filter}'" do
-      visit page_with_token('active', "/all_processes")
-
-      if search_filter
-        find('.recent-all-processes-filterable-control').set(search_filter)
-        sleep 1
-        wait_for_ajax
-      end
-
-      page_scrolls = expected_max/20 + 2
-      within('.arv-recent-all-processes') do
-        (0..page_scrolls).each do |i|
-          page.driver.scroll_to 0, 999000
-          begin
-            wait_for_ajax
-          rescue
-          end
-        end
-      end
+    test "all_processes page for search filter '#{search_filter}'" do
+      work_units_index(filters: [['any','@@', search_filter]])
+      assert_response :success
 
       # Verify that expected number of processes are found
-      found_items = page.all('tr[data-object-uuid]')
-      found_count = found_items.count
+      found_count = json_response['content'].scan('<tr').count
       if expected_min == expected_max
         assert_equal(true, found_count == expected_min,
           "Not found expected number of items. Expected #{expected_min} and found #{found_count}")
-        assert page.has_no_text? 'request failed'
       else
         assert_equal(true, found_count>=expected_min,
           "Found too few items. Expected at least #{expected_min} and found #{found_count}")
@@ -71,13 +45,24 @@ class AllProcessesTest < ActionDispatch::IntegrationTest
 
       # verify that all expected uuid links are found
       expected.each do |link|
-        assert_selector "a[href=\"#{link}\"]"
+        assert_match /href="#{link}"/, json_response['content']
       end
 
       # verify that none of the not_expected uuid links are found
       not_expected.each do |link|
-        assert_no_selector "a[href=\"#{link}\"]"
+        assert_no_match /href="#{link}"/, json_response['content']
       end
     end
   end
+
+  def work_units_index params
+    params = {
+      partial: :all_processes_rows,
+      format: :json,
+    }.merge(params)
+    encoded_params = Hash[params.map { |k,v|
+                            [k, (v.is_a?(Array) || v.is_a?(Hash)) ? v.to_json : v]
+                          }]
+    get :index, encoded_params, session_for(:active)
+  end
 end
diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb
new file mode 100644
index 0000000..63ba275
--- /dev/null
+++ b/apps/workbench/test/integration/work_units_test.rb
@@ -0,0 +1,58 @@
+require 'integration_helper'
+
+class WorkUnitsTest < ActionDispatch::IntegrationTest
+  setup do
+    need_javascript
+  end
+
+  test "scroll all_processes page" do
+      expected_min, expected_max, expected, not_expected = [
+        25, 100,
+        ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
+         '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+         '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7',
+         '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
+         '/container_requests/zzzzz-xvhdp-cr4completedcr2',
+         '/container_requests/zzzzz-xvhdp-cr4requestercn2'],
+        ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l',
+         '/container_requests/zzzzz-xvhdp-oneof60crs00001']
+      ]
+
+      visit page_with_token('active', "/all_processes")
+
+      page_scrolls = expected_max/20 + 2
+      within('.arv-recent-all-processes') do
+        (0..page_scrolls).each do |i|
+          page.driver.scroll_to 0, 999000
+          begin
+            wait_for_ajax
+          rescue
+          end
+        end
+      end
+
+      # Verify that expected number of processes are found
+      found_items = page.all('tr[data-object-uuid]')
+      found_count = found_items.count
+      if expected_min == expected_max
+        assert_equal(true, found_count == expected_min,
+          "Not found expected number of items. Expected #{expected_min} and found #{found_count}")
+        assert page.has_no_text? 'request failed'
+      else
+        assert_equal(true, found_count>=expected_min,
+          "Found too few items. Expected at least #{expected_min} and found #{found_count}")
+        assert_equal(true, found_count<=expected_max,
+          "Found too many items. Expected at most #{expected_max} and found #{found_count}")
+      end
+
+      # verify that all expected uuid links are found
+      expected.each do |link|
+        assert_selector "a[href=\"#{link}\"]"
+      end
+
+      # verify that none of the not_expected uuid links are found
+      not_expected.each do |link|
+        assert_no_selector "a[href=\"#{link}\"]"
+      end
+  end
+end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list