“Rake spec” failing most tests, but “rails s” working fine on Diaspora source

佐手、 提交于 2019-12-22 05:16:11

问题


I've got source of Diaspora cloned and I've got a working local pod that seems to run without a hitch. But when I run $ rake spec some initial tests pass and then all of them start failing. Also, what I found interesting was that they fail at different points each time rake spec is run.

They all fail with the error:

An error occurred in an after hook
  ActiveRecord::StatementInvalid: PG::ConnectionBad: PQsocket() can't get socket descriptor: ROLLBACK
  occurred at /home/darshan/.rvm/gems/ruby-2.0.0-p353@diaspora/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:650:in `async_exec'

Postgres' log said:

could not receive data from client: Connection reset by peer
unexpected EOF on client connection

回答1:


I ran into the same problem and found that by using the local unix socket file, rather than accessing the Postgres server via localhost, the problem seems to have gone away.

To achieve this, remove the host: localhost from your database.yml file, and re-run rake spec. This defaults back to the local socket file (usually .s.PGSQL.5432 in /tmp or /var/run/postgres, depending on your platform.)




回答2:


I ran into the same problem. I tried reverting to pg version 0.18.0 instead of 0.18.1, and that seems to fix it for me.




回答3:


Go to postgres.conf and change ssl = true to ssl = false

I found the fix for this issue here and it worked for me.



来源:https://stackoverflow.com/questions/21736107/rake-spec-failing-most-tests-but-rails-s-working-fine-on-diaspora-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!