3021: Add a performance test.
authorTom Clegg <tom@curoverse.com>
Sat, 10 Jan 2015 08:49:25 +0000 (03:49 -0500)
committerTom Clegg <tom@curoverse.com>
Wed, 14 Jan 2015 05:41:57 +0000 (00:41 -0500)
ActiveSupport doesn't seem to think its profiling code is compatible
with Ruby 2.1, but it seems to work if you patch up a version check in
activesupport:

.../activesupport-3.2.17/lib/active_support/testing/performance/ruby.rb

-if RUBY_VERSION.between?('1.9.2', '2.0.0')
+if RUBY_VERSION.between?('1.9.2', '3.0.0')

services/api/Gemfile
services/api/Gemfile.lock
services/api/test/performance/browsing_test.rb [deleted file]
services/api/test/performance/links_index_test.rb [new file with mode: 0644]

index a7da12263919f85a95c8dc713aa952d9b948fde5..4cb5b1936d094728d1e43ef282f2c1c428f24f99 100644 (file)
@@ -8,6 +8,7 @@ gem 'rails', '~> 3.2.0'
 group :test, :development do
   gem 'factory_girl_rails'
   gem 'database_cleaner'
+  gem 'ruby-prof'
   # Note: "require: false" here tells bunder not to automatically
   # 'require' the packages during application startup. Installation is
   # still mandatory.
index c2b2351543525bea174b429e8981078023937614..5f57d10c0439a09fa2da3be9cc944485cf8fedf8 100644 (file)
@@ -174,6 +174,7 @@ GEM
     rdoc (3.12.2)
       json (~> 1.4)
     ref (1.0.5)
+    ruby-prof (0.15.2)
     rvm-capistrano (1.5.1)
       capistrano (~> 2.15.4)
     sass (3.3.4)
@@ -240,6 +241,7 @@ DEPENDENCIES
   pg_power
   puma
   rails (~> 3.2.0)
+  ruby-prof
   rvm-capistrano
   sass-rails (>= 3.2.0)
   simplecov (~> 0.7.1)
diff --git a/services/api/test/performance/browsing_test.rb b/services/api/test/performance/browsing_test.rb
deleted file mode 100644 (file)
index 3fea27b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'test_helper'
-require 'rails/performance_test_help'
-
-class BrowsingTest < ActionDispatch::PerformanceTest
-  # Refer to the documentation for all available options
-  # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
-  #                          :output => 'tmp/performance', :formats => [:flat] }
-
-  def test_homepage
-    get '/'
-  end
-end
diff --git a/services/api/test/performance/links_index_test.rb b/services/api/test/performance/links_index_test.rb
new file mode 100644 (file)
index 0000000..a183a90
--- /dev/null
@@ -0,0 +1,14 @@
+require 'test_helper'
+require 'rails/performance_test_help'
+
+class IndexTest < ActionDispatch::PerformanceTest
+  def test_links_index
+    get '/arvados/v1/links', {format: :json}, auth(:admin)
+  end
+  def test_links_index_with_filters
+    get '/arvados/v1/links', {format: :json, filters: [%w[head_uuid is_a arvados#collection]].to_json}, auth(:admin)
+  end
+  def test_collections_index
+    get '/arvados/v1/collections', {format: :json}, auth(:admin)
+  end
+end