Commit 00bdaab1 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '340332-cleanup-cache_merge_to_ref_calls' into 'master'

Remove `cache_merge_to_ref_calls` feature flag

See merge request gitlab-org/gitlab!69904
parents 5ec6e984 ab017f16
......@@ -66,8 +66,7 @@ module MergeRequests
end
def commit(cache_merge_to_ref_calls = false)
if cache_merge_to_ref_calls &&
Feature.enabled?(:cache_merge_to_ref_calls, project, default_enabled: false)
if cache_merge_to_ref_calls
Rails.cache.fetch(cache_key, expires_in: 1.day) do
extracted_merge_to_ref
end
......
---
name: cache_merge_to_ref_calls
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67789
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338251
milestone: '14.2'
type: development
group: group::code review
default_enabled: false
......@@ -37,23 +37,21 @@ RSpec.describe MergeRequests::MergeToRefService do
expect(ref_head.id).to eq(result[:commit_id])
end
context 'cache_merge_to_ref_calls flag enabled', :use_clean_rails_memory_store_caching do
context 'cache_merge_to_ref_calls parameter', :use_clean_rails_memory_store_caching do
before do
stub_feature_flags(cache_merge_to_ref_calls: true)
# warm the cache
#
service.execute(merge_request, true)
end
context 'when cache_merge_to_ref_calls parameter is true' do
context 'when true' do
it 'caches the response', :request_store do
expect { 3.times { service.execute(merge_request, true) } }
.not_to change(Gitlab::GitalyClient, :get_request_count)
end
end
context 'when cache_merge_to_ref_calls parameter is false' do
context 'when false' do
it 'does not cache the response', :request_store do
expect(Gitlab::GitalyClient).to receive(:call).at_least(3).times.and_call_original
......@@ -61,24 +59,6 @@ RSpec.describe MergeRequests::MergeToRefService do
end
end
end
context 'cache_merge_to_ref_calls flag disabled', :use_clean_rails_memory_store_caching do
before do
stub_feature_flags(cache_merge_to_ref_calls: false)
# warm the cache
#
service.execute(merge_request, true)
end
[true, false].each do |cache_merge_to_ref_calls|
it 'does not cache the response, regardless of cache_merge_to_ref_calls state', :request_store do
expect(Gitlab::GitalyClient).to receive(:call).at_least(3).times.and_call_original
3.times { service.execute(merge_request, cache_merge_to_ref_calls) }
end
end
end
end
shared_examples_for 'successfully evaluates pre-condition checks' do
......
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