Travis CI:命令 "bundle exec rake" 以 1 退出

Travis CI: The command "bundle exec rake" exited with 1

我的 Travis 构建出现问题,构建失败并显示错误 The command "bundle exec rake" exited with 1Here is the build log from Travis. Here is a link 到 GitHub 仓库。

我已经尝试按照 this question 的建议将 require 'bundler' 添加到我的 Rakefile 中,但这没有任何效果。我在本地机器上没有问题 运行 bundle exec rake,所有测试都在本地通过。

这是 Travis 的回溯:

    /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.

非常感谢任何见解。

事实证明问题与我的 database.yml 文件中测试数据库的用户名有关。在查看 this SO question 后,我选择不为测试数据库设置用户名。构建终于通过了。希望这对以后的人有所帮助。