[ARVADOS] updated: 7def2fe2ed301a6b17a814bdc8b100fed59477cd

git at public.curoverse.com git at public.curoverse.com
Wed Dec 10 17:19:19 EST 2014


Summary of changes:
 apps/workbench/config/application.default.yml    |  7 +++++
 apps/workbench/config/database.yml               |  7 +++++
 apps/workbench/test/performance/browsing_test.rb | 16 +++++++----
 apps/workbench/test/performance_test_helper.rb   | 36 ++++++++++++++++++++++++
 apps/workbench/test/test_helper.rb               |  2 +-
 5 files changed, 62 insertions(+), 6 deletions(-)
 create mode 100644 apps/workbench/test/performance_test_helper.rb

       via  7def2fe2ed301a6b17a814bdc8b100fed59477cd (commit)
      from  12df34cfd4be1282b03db76beb85df7709fdf4a0 (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 7def2fe2ed301a6b17a814bdc8b100fed59477cd
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Wed Dec 10 17:18:19 2014 -0500

    4754: support RAILS_ENV=performance

diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index b485276..dd30641 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -27,6 +27,13 @@ diagnostics:
       template_uuid: zzzzz-p5p6p-1xbobfobk94ppbv
       input_paths: [zzzzz-4zz18-nz98douzhaa3jh2, zzzzz-4zz18-gpw9o5wpcti3nib]
 
+# Below is a sample setting for performance testing.
+# Configure workbench URL as "arvados_workbench_url"
+# Configure test user token as "user_token".
+performance:
+  arvados_workbench_url: https://localhost:3031
+  user_token: eu33jurqntstmwo05h1jr3eblmi961e802703y6657s8zb14r
+
 development:
   cache_classes: false
   eager_load: true
diff --git a/apps/workbench/config/database.yml b/apps/workbench/config/database.yml
index dd7669c..34a3224 100644
--- a/apps/workbench/config/database.yml
+++ b/apps/workbench/config/database.yml
@@ -30,3 +30,10 @@ diagnostics:
   database: db/diagnostics.sqlite3
   pool: 5
   timeout: 5000
+
+# Note: The "performance" database configuration is not actually used.
+performance:
+  adapter: sqlite3
+  database: db/diagnostics.sqlite3
+  pool: 5
+  timeout: 5000
diff --git a/apps/workbench/test/performance/browsing_test.rb b/apps/workbench/test/performance/browsing_test.rb
index 1340bcc..c355b59 100644
--- a/apps/workbench/test/performance/browsing_test.rb
+++ b/apps/workbench/test/performance/browsing_test.rb
@@ -2,11 +2,11 @@
 
 require 'test_helper'
 require 'rails/performance_test_help'
-require 'integration_helper'
+require 'performance_test_helper'
 require 'selenium-webdriver'
 require 'headless'
 
-class BrowsingTest < ActionDispatch::PerformanceTest
+class BrowsingTest < WorkbenchPerformanceTest
   self.profile_options = { :runs => 10,
                            :metrics => [:wall_time],
                            :output => 'tmp/performance',
@@ -19,25 +19,31 @@ class BrowsingTest < ActionDispatch::PerformanceTest
     Capybara.current_session.driver.browser.manage.window.resize_to(1024, 768)
   end
 
-  test "visit home page" do
-    visit page_with_token('active')
+  test "home page" do
+    visit_page_with_token
+    wait_for_ajax
     assert_text 'Dashboard'
     assert_selector 'a', text: 'Run a pipeline'
   end
 
   test "search for hash" do
-    visit page_with_token('active')
+    visit_page_with_token
+    wait_for_ajax
+    assert_text 'Dashboard'
 
     within('.navbar-fixed-top') do
       page.find_field('search').set('hash')
+      wait_for_ajax
       page.find('.glyphicon-search').click
     end
 
     # In the search dialog now. Expect at least one item in the result display.
     within '.modal-content' do
+      wait_for_ajax
       assert_text 'All projects'
       assert_text 'Search'
       assert_selector('div', text: 'zzzzz-')
+      click_button 'Cancel'
     end
   end
 end
diff --git a/apps/workbench/test/performance_test_helper.rb b/apps/workbench/test/performance_test_helper.rb
new file mode 100644
index 0000000..7c40354
--- /dev/null
+++ b/apps/workbench/test/performance_test_helper.rb
@@ -0,0 +1,36 @@
+require 'integration_helper'
+
+# Performance test can run in two two different ways:
+#
+# 1. Similar to other integration tests using the command:
+#     RAILS_ENV=test bundle exec rake test:benchmark
+#
+# 2. Against a configured workbench url using "RAILS_ENV=performance".
+#     RAILS_ENV=performance bundle exec rake TEST=test/performance/*.rb
+
+class WorkbenchPerformanceTest < ActionDispatch::PerformanceTest
+
+  # When running in "RAILS_ENV=performance" mode, uses performance config params.
+  # In this mode, prepends workbench URL to the given path provided,
+  # and visits that page using the configured "user_token".
+  def visit_page_with_token path='/'
+    if ENV["RAILS_ENV"].eql? 'performance'
+      token = Rails.configuration.user_token
+      workbench_url = Rails.configuration.arvados_workbench_url
+      if workbench_url.end_with? '/'
+        workbench_url = workbench_url[0, workbench_url.size-1]
+      end
+    else
+      token = 'active'
+      workbench_url = ''
+    end
+
+    visit page_with_token(token, (workbench_url + path))
+  end
+
+  # We do not want to reset the database fixtures in "RAILS_ENV=performance" mode.
+  protected
+  def self.reset_api_fixtures_now
+  end
+
+end
diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index 65eed78..1e7b8eb 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -1,4 +1,4 @@
-ENV["RAILS_ENV"] = "test" if (ENV["RAILS_ENV"] != "diagnostics")
+ENV["RAILS_ENV"] = "test" if (ENV["RAILS_ENV"] != "diagnostics" and ENV["RAILS_ENV"] != "performance")
 
 unless ENV["NO_COVERAGE_TEST"]
   begin

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list