Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 244
Darshan Rai Avatar asked Feb 12 '14 18:02

Darshan Rai


1 Answers

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

like image 59
Dan Garland Avatar answered Sep 25 '22 04:09

Dan Garland