Merge branch '8876-work-unit' into 8650-container-work-unit
[arvados.git] / apps / workbench / test / performance_test_helper.rb
1 require 'integration_helper'
2
3 # Performance test can run in two different ways:
4 #
5 # 1. Similar to other integration tests using the command:
6 #     RAILS_ENV=test bundle exec rake test:benchmark
7 #
8 # 2. Against a configured workbench url using "RAILS_ENV=performance".
9 #     RAILS_ENV=performance bundle exec rake test:benchmark
10
11 class WorkbenchPerformanceTest < ActionDispatch::PerformanceTest
12
13   # When running in "RAILS_ENV=performance" mode, uses performance
14   # config params.  In this mode, prepends workbench URL to the given
15   # path provided, and visits that page using the configured
16   # "user_token".
17   def visit_page_with_token path='/'
18     if Rails.env == 'performance'
19       token = Rails.configuration.user_token
20       workbench_url = Rails.configuration.arvados_workbench_url
21       if workbench_url.end_with? '/'
22         workbench_url = workbench_url[0, workbench_url.size-1]
23       end
24     else
25       token = 'active'
26       workbench_url = ''
27     end
28
29     visit page_with_token(token, (workbench_url + path))
30   end
31
32 end