我有一个zeus-parallel_tests和他的初始化问题:

我的gemfile:

group :development, :test do
  gem "sqlite3"
  gem "rspec-rails"
  gem "rspec-its"
  gem "guard-rspec"
  gem "quiet_assets"
  gem "dotenv-rails"
  gem "parallel_tests"
  gem "zeus-parallel_tests"
end


然后捆绑,好

我的database.yml配置:

connection: &connection
  adapter: postgresql
  host: localhost
  username: ********
  password: ********
  encoding: utf8
  min_messages: warning

development:
  database: app_development
  <<: *connection

test:
  database: app_test<%= ENV['TEST_ENV_NUMBER'] %>
  <<: *connection

production:
  database: app_production
  <<: *connection


然后zeus-parallel_tests初始化以创建我的custom_plan.rb和zeus.json


但是当我尝试创建我的并行数据库(我有一个具有8个线程的i7)时,我收到一个奇怪的消息:

> rake parallel:create
app_development already exists
app_development already exists
app_development already exists
app_development already exists
app_development already exists
app_development already exists
app_development already exists
app_development already exists


用并行尝试复制我的开发数据库?我希望他复制我的app_test数据库

> rake parallel:drop
> rake parallel:create
PG::Error: ERROR:  duplicate key value violates unique constraint "pg_database_datname_index"
DETAIL:  Key (datname)=(app_development) already exists.
: CREATE DATABASE "app_development" ENCODING = 'utf8'

and

/vendor/bundle/gems/activesupport-4.1.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'PG::Error: ERROR:  duplicate key value violates unique constraint "pg_database_datname_index"


经过操作后,我只有1个app_test数据库和1个app_development数据库。

任何想法 ?
我不碰custom_plan.rb和zeus.json
宙斯还好
rspec还可以
红宝石= 2.1.3
Rails = 4.1.13

最佳答案

我在使用parallel_specs gem(而不是zeus一个)时遇到了相同的问题-我相信它正在尝试在开发环境中运行。我不确定这是我的应用程序还是gem中的问题,但是我必须明确设置RAILS_ENV才能起作用:

RAILS_ENV=test bundle exec rake parallel:setup
RAILS_ENV=test bundle exec rake parallel:spec

10-06 13:04