Commit 7cced264 authored by David Fernandez's avatar David Fernandez

Remove the container_registry_expiration_policies_caching feature flag

Enabling caching for cleanup policies as described in
https://gitlab.com/gitlab-org/gitlab/-/issues/339129

Changelog: other
parent 8591f104
......@@ -146,8 +146,7 @@ module Projects
def caching_enabled?
container_expiration_policy &&
older_than.present? &&
Feature.enabled?(:container_registry_expiration_policies_caching, @project)
older_than.present?
end
def throttling_enabled?
......
---
name: container_registry_expiration_policies_caching
introduced_by_url:
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/340606
milestone: '14.3'
type: development
group: group::package
default_enabled: false
......@@ -41,7 +41,6 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
describe '#execute' do
subject { service.execute }
shared_examples 'reading and removing tags' do |caching_enabled: true|
context 'when no params are specified' do
let(:params) { {} }
......@@ -271,7 +270,7 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
it 'succeeds without a user' do
expect_delete(%w(Bb Ba C), container_expiration_policy: true)
caching_enabled ? expect_caching : expect_no_caching
expect_caching
is_expected.to eq(expected_service_response(deleted: %w(Bb Ba C), before_delete_size: 3))
end
......@@ -354,9 +353,8 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
)
end
end
end
context 'caching' do
context 'caching', :freeze_time do
let(:params) do
{
'name_regex_delete' => '.*',
......@@ -381,17 +379,12 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
before do
expect_delete(%w(Bb Ba C), container_expiration_policy: true)
travel_to(Time.zone.local(2021, 9, 2, 12, 0, 0))
# We froze time so we need to set the created_at stubs again
stub_digest_config('sha256:configA', 1.hour.ago)
stub_digest_config('sha256:configB', 5.days.ago)
stub_digest_config('sha256:configC', 1.month.ago)
end
after do
travel_back
end
it 'caches the created_at values' do
::Gitlab::Redis::Cache.with do |redis|
expect_mget(redis, tags_and_created_ats.keys)
......@@ -450,32 +443,6 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
DateTime.rfc3339(date_time.rfc3339).rfc3339
end
end
context 'with container_registry_expiration_policies_caching enabled for the project' do
before do
stub_feature_flags(container_registry_expiration_policies_caching: project)
end
it_behaves_like 'reading and removing tags', caching_enabled: true
end
context 'with container_registry_expiration_policies_caching disabled' do
before do
stub_feature_flags(container_registry_expiration_policies_caching: false)
end
it_behaves_like 'reading and removing tags', caching_enabled: false
end
context 'with container_registry_expiration_policies_caching not enabled for the project' do
let_it_be(:another_project) { create(:project) }
before do
stub_feature_flags(container_registry_expiration_policies_caching: another_project)
end
it_behaves_like 'reading and removing tags', caching_enabled: false
end
end
private
......
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