Don't talk to server during tests (ActiveRecord callbacks)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at cloudinary/carrier_wave.rb:160 from the stack trace and trace the delete callback invoked during ActiveRecord commits. Reproduce the test configuration with file storage and processing disabled, then verify that destroying a model makes no remote API call when enable_processing is false.
Written by the indexing model from the issue text.
Description
This is related to https://github.com/cloudinary/cloudinary_gem/issues/23
It seems the cloudinary gem still makes remote calls to https://api.cloudinary.com/v1_1/[accountname]/image/destroy when destroy() is invoked on a model, even when CarrierWave is configured to use the file store and enable_processing is false
if Rails.env.test? or Rails.env.cucumber?
CarrierWave.configure do |config|
config.storage = :file
config.enable_processing = false
end
end
The relevant stack trace is below. We only started to notice this after upgrading to Rails 4.2 and setting config.active_record.raise_in_transactional_callbacks = true in application.rb. Since the remote call is made in an after_commit hook, the tests didn't see the problem.
Can you please update the cloudinary gem to skip the call is enabled_processing==false?
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/cloudinary-1.0.75/lib/cloudinary/uploader.rb:284:in `call_api'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/cloudinary-1.0.75/lib/cloudinary/uploader.rb:133:in `destroy'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/cloudinary-1.0.75/lib/cloudinary/carrier_wave.rb:160:in `delete'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/carrierwave-0.10.0/lib/carrierwave/uploader/remove.rb:15:in `block in remove!'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/carrierwave-0.10.0/lib/carrierwave/uploader/callbacks.rb:17:in `with_callbacks'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/carrierwave-0.10.0/lib/carrierwave/uploader/remove.rb:14:in `remove!'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/carrierwave-0.10.0/lib/carrierwave/mount.rb:392:in `remove!'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/carrierwave-0.10.0/lib/carrierwave/mount.rb:195:in `remove_cover_image!'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/carrierwave-0.10.0/lib/carrierwave/orm/activerecord.rb:49:in `remove_cover_image!'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:253:in `call'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:253:in `block in conditional'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `block in call'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `each'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_commit_callbacks'
# /home/vagrant/.rvm/gems/ruby-2.1.6/gems/activerecord-4.2.1/lib/active_record/transactions.rb:314:in `committed!
- Dominant language
- Ruby
- Stars
- 420
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudinary/cloudinary_gem
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
cloudinary/cloudinary_gem#597 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
cloudinary/cloudinary_gem#591 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
cloudinary/cloudinary_gem#582 · 1 comment ·
-
404's when fetching .eml files (from Action Mailbox)May be free again @rnamba-cloudinary claimed this 400 days ago, and no pull request is open. Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
cloudinary/cloudinary_gem#581 · 1 comment ·
-
BlobKey, MirrorService and Sidekiq 8 are incompatibleMay be free again @const-cloudinary claimed this 541 days ago, and no pull request is open. Open
cloudinary/cloudinary_gem#573 · 3 comments · 1 assignee ·
All issues in cloudinary/cloudinary_gem
Similar issues
-
releases.rb silent failure cascades into NoMethodError crashes in downstream extensionsPossibly taken @Rucha0901 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jenkins-infra/jenkins.io#9598 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
yegor256/mailanes#361 · 1 comment ·
Maintainers usually reply within 1 day
-
Property accounts have no notes fieldPossibly taken @arnaurodondev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
we-promise/sure#5057 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
metacall/core#964 · 1 comment ·
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability
Difficulty 1/5 Under an hour Newbie friendliness 80/100