Project

General

Profile

Bug #24698

database "test_plugin_matrix-3-dev" does not exist when using `RemoteExecutionFeature.register` with Rails 5.2

Added by Ivan Necas almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:

Description

We've seen this in jenkins in rake db:create. It's connected to the way how Rails 5.2 initializes the environment even in db:create. I was not able to fully reproduce it locally, but the backtrace should be enough to solve the issue.

 ActiveRecord::NoDatabaseError: FATAL:  database "test_plugin_matrix-3-dev" does not exist
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:688:in `rescue in connect'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:683:in `connect'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:215:in `initialize'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:40:in `new'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:40:in `postgresql_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:809:in `new_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `checkout_new_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:832:in `try_to_checkout_new_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:793:in `acquire_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:521:in `checkout'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:380:in `connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:1008:in `retrieve_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/connection_handling.rb:90:in `connection'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/activerecord-5.2.0/lib/active_record/model_schema.rb:324:in `table_exists?'
15:57:51 /usr/local/rvm/gems/ruby-2.5.1@test_plugin_matrix-3/gems/foreman_remote_execution-1.6.1/app/models/remote_execution_feature.rb:27:in `register'
15:57:51 /var/lib/workspace/workspace/test_plugin_matrix@2/database/postgresql/ruby/2.5/slave/fast/plugin/lib/foreman_ansible/remote_execution.rb:16:in `register_rex_feature'

Related issues

Related to Foreman - Tracker #21834: Rails 5.2 upgrade tasksClosed

Related to Foreman Remote Execution - Bug #24910: Feature registration does not reliably work in seed testsClosed

Associated revisions

Revision 72d35d9d (diff)
Added by Ivan Necas almost 2 years ago

Fixes #24698 - RemoteExecutionFeature.register Rails 5.2 fix (#372)

Using table_exists? in db:create doesn't work anymore.

History

#1 Updated by Ivan Necas almost 2 years ago

#2 Updated by The Foreman Bot almost 2 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_remote_execution/pull/372 added

#3 Updated by Ivan Necas almost 2 years ago

  • Status changed from Ready For Testing to Closed

#4 Updated by Ivan Necas almost 2 years ago

  • Fixed in Releases foreman_remote_execution 1.6.2 (Foreman 1.20) added

#5 Updated by Marek Hulán almost 2 years ago

  • Related to Bug #24910: Feature registration does not reliably work in seed tests added

Also available in: Atom PDF