我对 zeus-parallel_tests 和他的初始化有疑问:
我的 gem 文件:
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 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 没问题 ruby = 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
关于ruby-on-rails - 无法使用 zeus 的 parallel_tests 创建并行数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34635915/