2016-01-06 53 views
1

parallel_tests并行数据库我有宙斯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 

然后捆绑,没事

我的数据库.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 init用于创建我的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

+0

在你的rails helper中,你是否在最顶级的env变量中测试了env? – MilesStanfield

+0

是的: 在我的顶部rails_helper.rb = ENV [“RAILS_ENV”] || =“test” –

+0

我没有答案,但我们遇到了类似的问题,它似乎与'dotenv -rails'。你有'.env.development'或类似的文件吗? –

回答

2

我用的是parallel_specs宝石有同样的问题(而不是zeus one) - 我相信它试图在开发环境中运行。我不知道这是否是我的应用程序或创业板的问题,但我不得不明确的RAILS_ENV此设置工作:

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

我相信这是因为春天的rake命令使用它。尝试禁用它或patching它。