Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test: threads being nil in ensure #32763

Merged
merged 1 commit into from
Apr 30, 2018

Conversation

pvalena
Copy link
Contributor

@pvalena pvalena commented Apr 30, 2018

Summary

If connection_pool is not installed, then ActiveSupport::Cache.lookup_store(...) fails. The failure gets however overriden by ensure section, with:

MemCacheStoreTest#test_connection_pool:
NoMethodError: undefined method `each' for nil:NilClass
    /builddir/build/BUILD/activesupport-5.2.0/usr/share/gems/gems/activesupport-5.2.0/test/cache/behaviors/connection_pool_behavior.rb:26:in `ensure in block in test_connection$
    /builddir/build/BUILD/activesupport-5.2.0/usr/share/gems/gems/activesupport-5.2.0/test/cache/behaviors/connection_pool_behavior.rb:26:in `block in test_connection_pool'
    /builddir/build/BUILD/activesupport-5.2.0/usr/share/gems/gems/activesupport-5.2.0/test/cache/stores/mem_cache_store_test.rb:124:in `emulating_latency'
    /builddir/build/BUILD/activesupport-5.2.0/usr/share/gems/gems/activesupport-5.2.0/test/cache/behaviors/connection_pool_behavior.rb:7:in `test_connection_pool'

as threads were not declared at that point.

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@matthewd
Copy link
Member

Technically I think it should be one more line higher -- above the begin.

More importantly, the same pattern appears 20 lines below, so if we're going to change it, we should do both.

@kamipo
Copy link
Member

kamipo commented Apr 30, 2018

It is strange, since connection_pool is part of Gemfile.

rails/Gemfile

Line 49 in 21adf4f

gem "connection_pool", require: false

Can you provide how step to reproduce?

@pvalena
Copy link
Contributor Author

pvalena commented Apr 30, 2018

Technically I think it should be one more line higher -- above the begin.

More importantly, the same pattern appears 20 lines below, so if we're going to change it, we should do both.

Sure, will change both.


Can you provide how step to reproduce?

Sorry, I forgot to mention, I've encountered this in Fedora, where I'm preparing a rebase to Rails 5.2. We execute the test suite, avoiding bundler, as we package the gems ourselves, like so:

ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'

The dependency connection_pool was simple not installed, as it was added in 5.2.

when connection_pool is not installed.
@utilum
Copy link
Contributor

utilum commented Apr 30, 2018

The dependency connection_pool was simple not installed, as it was added in 5.2.

Is it needed in master then, or does the problem only arise in earlier versions?

@rafaelfranca rafaelfranca merged commit 5909cdb into rails:master Apr 30, 2018
@pvalena pvalena deleted the as-fix-threads-nil branch May 1, 2018 00:40
@pvalena
Copy link
Contributor Author

pvalena commented May 1, 2018

Is it needed in master then, or does the problem only arise in earlier versions?

It's occurred since Rails 5.2. This is an edge-case, however. Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants