我的Travis构建出现问题,构建失败,错误为The command "bundle exec rake" exited with 1
。来自特拉维斯的Here is the build log。 Here is a link到GitHub回购。
我已尝试按this question的建议将require 'bundler'
添加到我的Rakefile中,但这没有任何效果。我在本地计算机上运行bundle exec rake
没有问题,所有测试都在本地传递。
以下是特拉维斯的回溯:
/home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect': FATAL: role "app" does not exist (ActiveRecord::NoDatabaseError)
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in `new_connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in `checkout_new_connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
from /home/travis/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
from /home/travis/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:565:in `retrieve_connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:87:in `connection'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:854:in `needs_migration?'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:397:in `load_schema_if_pending!'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:412:in `block in maintain_test_schema!'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:640:in `suppress_messages'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:417:in `method_missing'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:412:in `maintain_test_schema!'
from /home/travis/build/danielbonnell/app/spec/rails_helper.rb:25:in `<top (required)>'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration.rb:1181:in `block in requires='
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration.rb:1181:in `each'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration.rb:1181:in `requires='
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:110:in `block in process_options_into'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:109:in `each'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:109:in `process_options_into'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/configuration_options.rb:22:in `configure'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:96:in `setup'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:85:in `run'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:70:in `run'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib/rspec/core/runner.rb:38:in `invoke'
from /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/exe/rspec:4:in `<main>'
/home/travis/.rvm/rubies/ruby-2.0.0-p598/bin/ruby -I/home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/lib:/home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-support-3.2.2/lib /home/travis/build/danielbonnell/app/vendor/bundle/ruby/2.0.0/gems/rspec-core-3.2.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
The command "bundle exec rake" exited with 1.
非常感谢任何见解。
答案 0 :(得分:2)
事实证明问题与我database.yml
文件中测试数据库的用户名有关。在查看this SO question后,我选择不设置测试数据库的用户名。构建终于通过了。希望这有助于将来的某个人。