我一天中大部分时间都在努力用并行测试来设置travis,而且我无法理解为什么它没有工作。
# .travis.yml
language: ruby
rvm:
- 2.2.2
env:
- DB=postgresql
cache: bundler
addons:
postgresql: "9.4"
services:
- postgresql
- redis
script:
- RAILS_ENV=test bundle exec rake teaspoon
- RAILS_ENV=test xvfb-run -a bundle exec rake parallel:spec
before_script:
- "sh -e /etc/init.d/xvfb start"
- cp config/database.travis.yml config/database.yml
- export PARALLEL_TEST_PROCESSORS=4
- RAILS_ENV=development bundle exec rake db:drop
- RAILS_ENV=development bundle exec rake db:create
- RAILS_ENV=development bundle exec rake db:migrate
- bundle exec rake parallel:create
- bundle exec rake parallel:prepare
我的database.travis.yml
development:
adapter: postgresql
encoding: utf8
host: localhost
database: adiq_dev
pool: 25
username: postgres
password:
test:
adapter: postgresql
encoding: utf8
host: localhost
database: adiq_test<%= ENV['TEST_ENV_NUMBER'] %>
pool: 25
username: postgres
password:
在平行准备时,我不断得到这个
You have 174 pending migrations:
...
...
Run rake db:migrate to update your database then try again.
The command "bundle exec rake parallel:prepare" failed and exited with 1 during .
确切的命令链似乎在我的本地工作正常 我不明白,我哪里错了?
任何建议都是非常有价值的......我花了很多时间来努力完成这项工作。
答案 0 :(得分:0)
parallel:load_schema就是一招。更新了文件......
# .travis.yml
language: ruby
rvm:
- 2.2.2
env:
- DB=postgresql
cache: bundler
addons:
postgresql: "9.4"
services:
- postgresql
- mongodb
- redis
script:
- RAILS_ENV=test bundle exec rake teaspoon
- RAILS_ENV=test xvfb-run -a bundle exec rake parallel:spec
before_script:
- "sh -e /etc/init.d/xvfb start"
- cp config/database.travis.yml config/database.yml
- cp config/mongoid.travis.yml config/mongoid.yml
- export PARALLEL_TEST_PROCESSORS=4
- RAILS_ENV=development bundle exec rake db:create db:migrate
- bundle exec rake parallel:create parallel:load_schema parallel:prepare