5737: Return of Minitest
authorTom Clegg <tom@curoverse.com>
Wed, 12 Oct 2016 02:17:52 +0000 (22:17 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 12 Oct 2016 15:30:19 +0000 (11:30 -0400)
services/api/Gemfile
services/api/Gemfile.lock
services/api/test/functional/arvados/v1/collections_controller_test.rb
services/api/test/functional/arvados/v1/links_controller_test.rb
services/api/test/integration/collections_performance_test.rb
services/api/test/integration/database_reset_test.rb
services/api/test/integration/websocket_test.rb
services/api/test/test_helper.rb
services/api/test/unit/collection_performance_test.rb
services/api/test/unit/permission_test.rb

index a151138a34ad928934fe9564b01409af9d589d8b..dfaa07049bd31e818f5ca5231e455545c5488145 100644 (file)
@@ -9,11 +9,12 @@ group :test, :development do
   gem 'factory_girl_rails'
   gem 'database_cleaner'
   gem 'ruby-prof'
-  gem 'test-unit', require: false
-  gem 'test-unit-activesupport', require: false
   # Note: "require: false" here tells bunder not to automatically
   # 'require' the packages during application startup. Installation is
   # still mandatory.
+  gem 'test-unit', '~> 3.0', require: false
+  gem 'minitest-rails', require: false
+  gem 'minitest', '~> 4.0', require: false
   gem 'simplecov', '~> 0.7.1', require: false
   gem 'simplecov-rcov', require: false
   gem 'mocha', require: false
index 814aa14ea766783ea006b022036d253a2d19823f..d9edcc64fa4ee48e455e4ad17dff6ac3821b5172 100644 (file)
@@ -132,6 +132,13 @@ GEM
     memoist (0.15.0)
     metaclass (0.0.4)
     mime-types (1.25.1)
+    minitest (4.7.5)
+    minitest-rails (1.0.1)
+      minitest (~> 4.7)
+      minitest-test (~> 1.0)
+      railties (>= 3.0, < 4.1)
+    minitest-test (1.1.0)
+      minitest (~> 4.0)
     mocha (1.2.0)
       metaclass (~> 0.0.1)
     multi_json (1.12.1)
@@ -223,9 +230,6 @@ GEM
     sshkey (1.8.0)
     test-unit (3.2.1)
       power_assert
-    test-unit-activesupport (1.0.6)
-      activesupport
-      test-unit
     test_after_commit (1.1.0)
       activerecord (>= 3.2)
     themes_for_rails (0.5.1)
@@ -262,6 +266,8 @@ DEPENDENCIES
   jquery-rails
   lograge
   logstash-event
+  minitest (~> 4.0)
+  minitest-rails
   mocha
   multi_json
   oj
@@ -279,8 +285,7 @@ DEPENDENCIES
   simplecov (~> 0.7.1)
   simplecov-rcov
   sshkey
-  test-unit
-  test-unit-activesupport
+  test-unit (~> 3.0)
   test_after_commit
   themes_for_rails
   therubyracer
index 64f61957a8a26f5f4a60a78d42fe26056499667e..634fce79706254069196160410d132e2ed277ae1 100644 (file)
@@ -751,13 +751,11 @@ EOS
     [2**8, :success],
     [2**18, 422],
   ].each do |description_size, expected_response|
-    test "create collection with description size #{description_size}
+    # Descriptions are not part of search indexes. Skip until
+    # full-text search is implemented, at which point replace with a
+    # search in description.
+    skip "create collection with description size #{description_size}
           and expect response #{expected_response}" do
-
-      omit "(Descriptions are not part of search indexes. Skip until
-      full-text search is implemented, at which point replace with a
-      search in description.)"
-
       authorize_with :active
 
       description = 'here is a collection with a very large description'
index af3cd3a6a2833ffb7de7896f9a437f8a3ea1096c..6a19bdf4ad0baf8946d54be21c965f9b2d783ebd 100644 (file)
@@ -305,8 +305,8 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
     assert_response 404
   end
 
-  test "retrieve all permissions using generic links index api" do
-    omit "(not implemented)"
+  # not implemented
+  skip "retrieve all permissions using generic links index api" do
     # Links.readable_by() does not return the full set of permission
     # links that are visible to a user (i.e., all permission links
     # whose head_uuid references an object for which the user has
index a952c202cb7dbadf73fae734ca0141d000ac5cde..f6f39fe526edff84cc1679887bf400ecd2c3bc00 100644 (file)
@@ -5,8 +5,7 @@ require 'helpers/time_block'
 class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
   include ManifestExamples
 
-  test "crud cycle for a collection with a big manifest" do
-    slow_test
+  slow_test "crud cycle for a collection with a big manifest" do
     bigmanifest = time_block 'make example' do
       make_manifest(streams: 100,
                     files_per_stream: 100,
@@ -39,8 +38,7 @@ class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
     end
   end
 
-  test "memory usage" do
-    slow_test
+  slow_test "memory usage" do
     hugemanifest = make_manifest(streams: 1,
                                  files_per_stream: 2000,
                                  blocks_per_file: 200,
index ecb2f2a05831a44a7798fd98d048a821878fd11a..029e37cbbfed18075a73785ce1b565d5907202cd 100644 (file)
@@ -3,8 +3,7 @@ require 'test_helper'
 class DatabaseResetTest < ActionDispatch::IntegrationTest
   self.use_transactional_fixtures = false
 
-  test "reset fails when Rails.env != 'test'" do
-    slow_test
+  slow_test "reset fails when Rails.env != 'test'" do
     rails_env_was = Rails.env
     begin
       Rails.env = 'production'
@@ -22,8 +21,7 @@ class DatabaseResetTest < ActionDispatch::IntegrationTest
     assert_response 403
   end
 
-  test "database reset doesn't break basic CRUD operations" do
-    slow_test
+  slow_test "database reset doesn't break basic CRUD operations" do
     active_auth = auth(:active)
     admin_auth = auth(:admin)
 
@@ -49,8 +47,7 @@ class DatabaseResetTest < ActionDispatch::IntegrationTest
     assert_response 404
   end
 
-  test "roll back database change" do
-    slow_test
+  slow_test "roll back database change" do
     active_auth = auth(:active)
     admin_auth = auth(:admin)
 
index 2128be9443c8e65a48d357597b3b3cfb1ea2b3fb..8fd968576583b197328c7c049a9aaa0c4a0471d9 100644 (file)
@@ -375,8 +375,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     assert_equal expect_next_logs[1].object_uuid, l2
   end
 
-  test "connect, subscribe, get event, unsubscribe" do
-    slow_test
+  slow_test "connect, subscribe, get event, unsubscribe" do
     state = 1
     spec = nil
     spec_ev_uuid = nil
@@ -425,8 +424,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     assert_equal spec.uuid, spec_ev_uuid
   end
 
-  test "connect, subscribe, get event, unsubscribe with filter" do
-    slow_test
+  slow_test "connect, subscribe, get event, unsubscribe with filter" do
     state = 1
     spec = nil
     spec_ev_uuid = nil
@@ -475,8 +473,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
   end
 
 
-  test "connect, subscribe, get event, try to unsubscribe with bogus filter" do
-    slow_test
+  slow_test "connect, subscribe, get event, try to unsubscribe with bogus filter" do
     state = 1
     spec = nil
     spec_ev_uuid = nil
@@ -526,10 +523,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     assert_equal human.uuid, human_ev_uuid
   end
 
-
-
-  test "connected, not subscribed, no event" do
-    slow_test
+  slow_test "connected, not subscribed, no event" do
     authorize_with :active
 
     ws_helper(token: :active, timeout: false) do |ws|
@@ -549,8 +543,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
     end
   end
 
-  test "connected, not authorized to see event" do
-    slow_test
+  slow_test "connected, not authorized to see event" do
     state = 1
 
     authorize_with :admin
@@ -665,8 +658,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
 
   end
 
-  test "connect, subscribe, lots of events" do
-    slow_test
+  slow_test "connect, subscribe, lots of events" do
     state = 1
     event_count = 0
     log_start = Log.order(:id).last.id
index 2986f697e66f78145ad09e00a7d66be9297735da..d998c92cadf85cd5dc80364e15a88611b7f5346c 100644 (file)
@@ -21,9 +21,11 @@ unless ENV["NO_COVERAGE_TEST"]
 end
 
 require File.expand_path('../../config/environment', __FILE__)
-require 'test/unit/active_support'
+gem 'minitest'
 require 'rails/test_help'
-require 'mocha/test_unit'
+require 'minitest-rails'
+require 'minitest/autorun'
+require 'mocha'
 
 module ArvadosTestSupport
   def json_response
@@ -113,13 +115,18 @@ class ActiveSupport::TestCase
                              "HTTP_AUTHORIZATION" => "OAuth2 #{t}")
   end
 
-  def slow_test
-    omit "RAILS_TEST_SHORT is set" if self.class.skip_slow_tests?
-  end
-
   def self.skip_slow_tests?
     !(ENV['RAILS_TEST_SHORT'] || '').empty?
   end
+
+  def self.skip(*args, &block)
+  end
+
+  def self.slow_test(name, &block)
+    define_method(name, block) unless skip_slow_tests?
+  end
+
+  alias_method :skip, :omit
 end
 
 class ActionController::TestCase
index 1c6e4f2db2c0dfafcde3d7fba519fe8e4431cf6b..c9e702a185be7a7240f42293339b05ba4f123c0e 100644 (file)
@@ -17,8 +17,7 @@ class CollectionModelPerformanceTest < ActiveSupport::TestCase
   end
 
   # "crrud" == "create read render update delete", not a typo
-  test "crrud cycle for a collection with a big manifest)" do
-    slow_test
+  slow_test "crrud cycle for a collection with a big manifest)" do
     bigmanifest = time_block 'make example' do
       make_manifest(streams: 100,
                     files_per_stream: 100,
index dc3be0b7a4b03af0a2327572b15e3f55a250974f..5653a4411c9bd3dd52e5758fa398d36c2049eec1 100644 (file)
@@ -142,8 +142,8 @@ class PermissionTest < ActiveSupport::TestCase
     assert test_perm.destroy, "could not delete new permission on target object"
   end
 
-  test "can_manage permission on a non-group object" do
-    omit "bug #3091"
+  # bug #3091
+  skip "can_manage permission on a non-group object" do
     set_user_from_auth :admin
 
     ob = Specimen.create!