X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f59d6d76acf9c6f5bb95c5902b2c9a1cca427e93..0b2005c4d8e1f8a5e1563373eb1eb49a908b7540:/apps/workbench/test/test_helper.rb diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb index e8f787b246..2b480f9b39 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 @@ -267,6 +267,10 @@ class ActiveSupport::TestCase protected def self.reset_api_fixtures_now + # Never try to reset fixtures when we're just using test + # infrastructure to run performance/diagnostics suites. + return unless Rails.env == 'test' + auth = api_fixture('api_client_authorizations')['admin_trustedclient'] Thread.current[:arvados_api_token] = auth['api_token'] ArvadosApiClient.new.api(nil, '../../database/reset', {}) @@ -289,6 +293,20 @@ class RequestDuck end end +# Example: +# +# apps/workbench$ RAILS_ENV=test bundle exec irb -Ilib:test +# > load 'test/test_helper.rb' +# > singletest 'integration/collection_upload_test.rb', 'Upload two empty files' +# +def singletest test_class_file, test_name + load File.join('test', test_class_file) + Minitest.run ['-v', '-n', "test_#{test_name.gsub ' ', '_'}"] + Object.send(:remove_const, + test_class_file.gsub(/.*\/|\.rb$/, '').camelize.to_sym) + ::Minitest::Runnable.runnables.reject! { true } +end + if ENV["RAILS_ENV"].eql? 'test' ApiServerForTests.new.run ApiServerForTests.new.run ["--websockets"]