-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
In v1.0.9 of solid_cache, the inclusion of database: cache in the cache.yml default section is making new Rails 8 apps fail on CI if they have any tests to run. This change was introduced in #279. It used to be that database: cache was in the cache.yml production section, and Rails apps used to work on CI.
Steps to repro
rails -v # Should be any version that is >= 8.0.0
rails new myapp; cd myapp
bin/rails generate test_unit:model hello
CI=true bin/rails testActual results
The tests error out:
/Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/database_configurations.rb:231:in 'ActiveRecord::DatabaseConfigurations#resolve_symbol_connection': The `cache` database is not configured for the `test` environment. (ActiveRecord::AdapterNotSpecified)
Available database configurations are:
default
development
test
production: primary, cache, queue, cable
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/database_configurations.rb:181:in 'ActiveRecord::DatabaseConfigurations#resolve'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_handling.rb:394:in 'ActiveRecord::ConnectionHandling#resolve_config_for_connection'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_handling.rb:100:in 'block (2 levels) in ActiveRecord::ConnectionHandling#connects_to'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_handling.rb:99:in 'Hash#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_handling.rb:99:in 'block in ActiveRecord::ConnectionHandling#connects_to'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_handling.rb:98:in 'Hash#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_handling.rb:98:in 'ActiveRecord::ConnectionHandling#connects_to'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.9/app/models/solid_cache/record.rb:9:in '<class:Record>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.9/app/models/solid_cache/record.rb:4:in '<module:SolidCache>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.9/app/models/solid_cache/record.rb:3:in '<main>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/core_ext/kernel.rb:26:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.9/app/models/solid_cache/entry.rb:4:in '<module:SolidCache>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.9/app/models/solid_cache/entry.rb:3:in '<main>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/core_ext/kernel.rb:26:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:180:in 'Module#const_get'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:180:in 'block in Zeitwerk::Loader::EagerLoad#actual_eager_load_dir'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/helpers.rb:47:in 'block in Zeitwerk::Loader::Helpers#ls'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/helpers.rb:25:in 'Array#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/helpers.rb:25:in 'Zeitwerk::Loader::Helpers#ls'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:168:in 'Zeitwerk::Loader::EagerLoad#actual_eager_load_dir'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:17:in 'block (2 levels) in Zeitwerk::Loader::EagerLoad#eager_load'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:16:in 'Hash#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:16:in 'block in Zeitwerk::Loader::EagerLoad#eager_load'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:10:in 'Thread::Mutex#synchronize'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/eager_load.rb:10:in 'Zeitwerk::Loader::EagerLoad#eager_load'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader.rb:431:in 'block in Zeitwerk::Loader.eager_load_all'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/registry/loaders.rb:10:in 'Array#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/registry/loaders.rb:10:in 'Zeitwerk::Registry::Loaders#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader.rb:429:in 'Zeitwerk::Loader.eager_load_all'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/application/finisher.rb:79:in 'block in <module:Finisher>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/initializable.rb:24:in 'BasicObject#instance_exec'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/initializable.rb:24:in 'Rails::Initializable::Initializer#run'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/initializable.rb:103:in 'block in Rails::Initializable#run_initializers'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:231:in 'block in TSort.tsort_each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:353:in 'block (2 levels) in TSort.each_strongly_connected_component'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:434:in 'TSort.each_strongly_connected_component_from'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:352:in 'block in TSort.each_strongly_connected_component'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/initializable.rb:59:in 'Array#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/initializable.rb:59:in 'Rails::Initializable::Collection#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Method#call'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'TSort.each_strongly_connected_component'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:229:in 'TSort.tsort_each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:208:in 'TSort#tsort_each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/initializable.rb:102:in 'Rails::Initializable#run_initializers'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/application.rb:442:in 'Rails::Application#initialize!'
from /Users/jerome/c/tmp/myapp/config/environment.rb:5:in '<main>'
from /Users/jerome/c/tmp/myapp/test/test_helper.rb:2:in 'Kernel#require_relative'
from /Users/jerome/c/tmp/myapp/test/test_helper.rb:2:in '<main>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/core_ext/kernel.rb:34:in 'Kernel#require'
from /Users/jerome/c/tmp/myapp/test/models/hello_test.rb:1:in '<main>'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/core_ext/kernel.rb:34:in 'Kernel#require'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/test_unit/runner.rb:71:in 'block in Rails::TestUnit::Runner.load_tests'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/test_unit/runner.rb:69:in 'Array#each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/rails/test_unit/runner.rb:69:in 'Rails::TestUnit::Runner.load_tests'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/railties-8.1.1/lib/minitest/rails_plugin.rb:140:in 'block in Minitest.plugin_rails_options'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1793:in 'block in OptionParser#parse_in_order'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:925:in 'OptionParser::List#search'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1923:in 'block in OptionParser#visit'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1922:in 'Array#reverse_each'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1922:in 'OptionParser#visit'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1793:in 'OptionParser#parse_in_order'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1703:in 'OptionParser#order!'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1830:in 'OptionParser#permute!'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1855:in 'OptionParser#parse!'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/minitest-5.26.0/lib/minitest.rb:224:in 'block in Minitest.process_args'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/optparse.rb:1188:in 'OptionParser#initialize'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/minitest-5.26.0/lib/minitest.rb:149:in 'Class#new'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/minitest-5.26.0/lib/minitest.rb:149:in 'Minitest.process_args'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/minitest-5.26.0/lib/minitest.rb:273:in 'Minitest.run'
from /Users/jerome/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0/gems/minitest-5.26.0/lib/minitest.rb:86:in 'block in Minitest.autorun'
Expected results
The tests run successfully:
Running 0 tests in a single process (parallelization threshold is 50)
Run options: --seed 1642
# Running:
Finished in 0.000157s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
Additional notes
CI=true causes Rails test environments to eager load by default: https://github.com/rails/rails/blob/a22491daf9a12df8ea9d4bd91de12bf397c4a549/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt#L16
Metadata
Metadata
Assignees
Labels
No labels