From b8c0e7790880e21f1b8f8b7943876d1fa3d2e9eb Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 13 Sep 2018 12:39:54 +0100 Subject: [PATCH] DEV: apply plugin migrations when testing in Travis and Docker In `RAILS_ENV=test`, plugins are not loaded by default. Therefore we need to explicitly specify `LOAD_PLUGINS=1` when we want to apply plugin migrations. --- .travis.yml | 2 +- lib/tasks/docker.rake | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c93734e8247..3e90410c5d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,7 +68,7 @@ install: - bash -c "if [ '$RAILS_MASTER' == '1' ]; then bundle update --retry=3 --jobs=3 arel rails seed-fu > /dev/null; fi" - bash -c "if [ '$RAILS_MASTER' == '0' ]; then bundle install --without development --deployment --retry=3 --jobs=3 > /dev/null; fi" - bash -c "if [ '$QUNIT_RUN' == '1' ] || [ '$RUN_LINT' == '1' ]; then yarn install --dev > /dev/null; fi" - - bash -c "if [ '$RUN_LINT' != '1' ]; then bundle exec rake db:create db:migrate > /dev/null; fi" + - bash -c "if [ '$RUN_LINT' != '1' ]; then LOAD_PLUGINS=1 bundle exec rake db:create db:migrate > /dev/null; fi" script: - | diff --git a/lib/tasks/docker.rake b/lib/tasks/docker.rake index 9ee562e0fca..65276b759c4 100644 --- a/lib/tasks/docker.rake +++ b/lib/tasks/docker.rake @@ -95,7 +95,11 @@ task 'docker:test' do @good &&= run_or_fail("bundle exec rake plugin:install_all_official") end - @good &&= run_or_fail("bundle exec rake db:migrate") + if ENV["SKIP_PLUGINS"] + @good &&= run_or_fail("bundle exec rake db:migrate") + else + @good &&= run_or_fail("LOAD_PLUGINS=1 bundle exec rake db:migrate") + end puts "travis_fold:end:prepare_tests" if ENV["TRAVIS"]