Antoine Bernard
Antoine Bernard

Reputation: 101

Can't create parallel database with parallel_tests with zeus

i have an issus with zeus-parallel_tests and his initialization :

my 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

then bundle, all right

my database.yml configuration :

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

then zeus-parallel_tests init for create my custom_plan.rb and zeus.json all right

but when i try to create my parallels databases (i have an i7 with 8 threads) i have a weird message :

> 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

With parallel try to duplicate my development database ? i expected he duplicate my app_test database

> 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"

and i have only 1 app_test database and 1 app_development database after my manipulation..

Any idea ? i don't touch custom_plan.rb and zeus.json zeus is ok rspec is ok Ruby = 2.1.3 Rails = 4.1.13

Upvotes: 3

Views: 2160

Answers (2)

Ilias Spyropoulos
Ilias Spyropoulos

Reputation: 136

I believe it's because of Spring, the rake command uses it. Try disabling it or patching it.

Upvotes: 1

d3vkit
d3vkit

Reputation: 1982

I was having the same issue using the parallel_specs gem (not the zeus one) - I believe it was trying to run in development environment. I am not sure if this is a problem in my app or in the gem, but I had to explicitly set the RAILS_ENV for this to work:

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

Upvotes: 6

Related Questions