From 90c00f075a42e9133af035b206a511d438954a3f Mon Sep 17 00:00:00 2001 From: Keiji Matsuzaki Date: Wed, 3 May 2017 19:20:38 +0900 Subject: [PATCH] Added support parallel_tests (#2740) - Added new gem the `parallel_tests`. - Updated .travis.yml. - Improved scripts and environment variable. --- .travis.yml | 9 ++++++--- Gemfile | 1 + Gemfile.lock | 4 ++++ config/database.yml | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 58be0908f4..015acd4689 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,9 @@ env: - LOCAL_HTTPS=true - RAILS_ENV=test - CXX=g++-4.8 + - NOKOGIRI_USE_SYSTEM_LIBRARIES=true + - PARALLEL_TEST_PROCESSORS=2 + addons: postgresql: 9.4 apt: @@ -31,7 +34,7 @@ rvm: services: - redis-server -bundler_args: --without development production --retry=3 --jobs=3 +bundler_args: --without development production --retry=3 --jobs=16 install: - nvm install @@ -40,10 +43,10 @@ install: - yarn install before_script: - - bundle exec rails db:create db:schema:load + - bundle exec rake parallel:create parallel:load_schema parallel:prepare - bundle exec rails assets:precompile script: - - bundle exec rspec + - bundle exec parallel_test spec/ --group-by filesize --type rspec - npm test - i18n-tasks unused diff --git a/Gemfile b/Gemfile index 8009e2cbec..1287afe441 100644 --- a/Gemfile +++ b/Gemfile @@ -77,6 +77,7 @@ group :test do gem 'rspec-sidekiq' gem 'simplecov', require: false gem 'webmock' + gem 'parallel_tests' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index ab811bcfd6..218e17237c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -270,6 +270,9 @@ GEM paperclip-av-transcoder (0.6.4) av (~> 0.9.0) paperclip (>= 2.5.2) + parallel (1.11.1) + parallel_tests (2.14.1) + parallel parser (2.4.0.0) ast (~> 2.2) pg (0.20.0) @@ -510,6 +513,7 @@ DEPENDENCIES ox paperclip (~> 5.1) paperclip-av-transcoder + parallel_tests pg pghero pkg-config diff --git a/config/database.yml b/config/database.yml index 810b832780..39393e93ad 100644 --- a/config/database.yml +++ b/config/database.yml @@ -13,7 +13,7 @@ development: # Do not set this db to the same as development or production. test: <<: *default - database: mastodon_test + database: mastodon_test<%= ENV['TEST_ENV_NUMBER'] %> production: <<: *default