本文介绍了“ Rake spec”未通过大多数测试,但“ rails s”在Diaspora源上工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经克隆了Diaspora的来源,并且我有一个可以正常运行的本地吊舱。但是,当我运行 $ rake spec 时,一些初始测试通过了,然后所有测试都开始失败。另外,我发现有趣的是,每次运行 rake spec 时,它们都会在不同的点失败。

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的日志说:

Postgres' log said:

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


推荐答案

我遇到了同样的问题,发现使用本地unix套接字文件而不是访问Postgres通过本地主机服务器,问题似乎已经消失。

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.

要实现此目的,请从database.yml文件中删除 host:localhost $$,然后重新运行 rake spec 。默认返回到本地套接字文件(通常是/ tmp或/ var / run / postgres中的.s.PGSQL.5432,具体取决于您的平台。)

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

这篇关于“ Rake spec”未通过大多数测试,但“ rails s”在Diaspora源上工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 15:11