test-prof: Rails 7.2 error

Tell us about your environment

Ruby Version: 3.2.2

Framework Version (RSpec, Minitest, FactoryGirl, Rails, whatever): rspec-rails: 7.x, Rails 7.2.1

TestProf Version: 1.4.2

What did you do?

In the process to upgrade to Rails 7.2.1 I came across with an error, this error

What did you expect to happen?

I expect the test suite run without problem.

What actually happened?

On my way to upgrade rails 7.2 I got following error:

An error occurred in an `after(:context)` hook.
Failure/Error: raise "There isn't a pinned connection #{object_id}" unless @pinned_connection

RuntimeError:
  There isn't a pinned connection 143060
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all/adapters/active_record.rb:20:in `block in rollback_transaction'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all/adapters/active_record.rb:19:in `each'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all/adapters/active_record.rb:19:in `rollback_transaction'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all.rb:51:in `block in rollback_transaction'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all.rb:154:in `block in run_hooks'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all.rb:119:in `run'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all.rb:154:in `run_hooks'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/before_all.rb:50:in `rollback_transaction'
# /usr/local/bundle/gems/test-prof-1.4.2/lib/test_prof/recipes/rspec/before_all.rb:34:in `block in before_all'

Finished in 2 minutes 8.6 seconds (files took 11.15 seconds to load)
45 examples, 4 failures, **1 error occurred outside of examples**

above error do not make fail the test suite but it’s a bit annoying and I looking for info to solve it or even check if I have an issue in my code, any thoughs?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19

Commits related to this issue

Most upvoted comments

Hey everyone,

Thanks a lot for all the details and logs. With your help, I was finally able to reproduce the problem, so the fix has been pushed to master. Could you please give a try?

@osjjames I’ll update to rails 7.2.2 and let you know if error is fixed.

It happens for me in both cases running single test or the whole test suite. Does not use mutli db setup, single db only using pg adapter, any_fixture and let_it_be.

hi @palkan

I have the same configurations and am facing the same issue.

using Multi-tenancy with multiple database.

error being raised when using let_it_be

Hi @palkan,

Do you use DatabaseCleaner or similar?

I use config.use_transactional_fixtures = true

Do you have a multi-database configuration?

Yes, I have multi-tenant

Is there a particular test that raises an error or any test using let_it_be / before_all?

the error raise when use let_it_be