2016-01-06 57 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它。