Commit 853aafad authored by James Fargher's avatar James Fargher

Merge branch '331768-remove-composer-callback' into 'master'

Remove unused package callback [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!64016
parents 9f0278f8 ca05efee
......@@ -158,7 +158,7 @@ class Packages::Package < ApplicationRecord
joins(:project).reorder(keyset_order)
end
after_commit :update_composer_cache, on: :destroy, if: -> { composer? }
after_commit :update_composer_cache, on: :destroy, if: -> { composer? && Feature.disabled?(:disable_composer_callback) }
def self.only_maven_packages_with_path(path, use_cte: false)
if use_cte
......
---
name: disable_composer_callback
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64016
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333587
milestone: '14.0'
type: development
group: group::package
default_enabled: false
......@@ -1019,10 +1019,24 @@ RSpec.describe Packages::Package, type: :model do
package.composer_metadatum.reload
end
it 'schedule the update job' do
expect(::Packages::Composer::CacheUpdateWorker).to receive(:perform_async).with(project.id, package_name, package.composer_metadatum.version_cache_sha)
context 'with feature flag disabled' do
before do
stub_feature_flags(disable_composer_callback: false)
end
it 'schedule the update job' do
expect(::Packages::Composer::CacheUpdateWorker).to receive(:perform_async).with(project.id, package_name, package.composer_metadatum.version_cache_sha)
package.destroy!
end
end
package.destroy!
context 'with feature flag enabled' do
it 'does nothing' do
expect(::Packages::Composer::CacheUpdateWorker).not_to receive(:perform_async)
package.destroy!
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment