Commit 48a39711 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch '340606-feature-flag-cleanup' into 'master'

Remove the container_registry_expiration_policies_caching feature flag

See merge request gitlab-org/gitlab!73737
parents 2b5e3a6a 7cced264
...@@ -146,8 +146,7 @@ module Projects ...@@ -146,8 +146,7 @@ module Projects
def caching_enabled? def caching_enabled?
container_expiration_policy && container_expiration_policy &&
older_than.present? && older_than.present?
Feature.enabled?(:container_registry_expiration_policies_caching, @project)
end end
def throttling_enabled? 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_ ...@@ -41,7 +41,6 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
describe '#execute' do describe '#execute' do
subject { service.execute } subject { service.execute }
shared_examples 'reading and removing tags' do |caching_enabled: true|
context 'when no params are specified' do context 'when no params are specified' do
let(:params) { {} } let(:params) { {} }
...@@ -271,7 +270,7 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_ ...@@ -271,7 +270,7 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
it 'succeeds without a user' do it 'succeeds without a user' do
expect_delete(%w(Bb Ba C), container_expiration_policy: true) 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)) is_expected.to eq(expected_service_response(deleted: %w(Bb Ba C), before_delete_size: 3))
end end
...@@ -354,9 +353,8 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_ ...@@ -354,9 +353,8 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
) )
end end
end end
end
context 'caching' do context 'caching', :freeze_time do
let(:params) do let(:params) do
{ {
'name_regex_delete' => '.*', 'name_regex_delete' => '.*',
...@@ -381,17 +379,12 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_ ...@@ -381,17 +379,12 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
before do before do
expect_delete(%w(Bb Ba C), container_expiration_policy: true) 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 # 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:configA', 1.hour.ago)
stub_digest_config('sha256:configB', 5.days.ago) stub_digest_config('sha256:configB', 5.days.ago)
stub_digest_config('sha256:configC', 1.month.ago) stub_digest_config('sha256:configC', 1.month.ago)
end end
after do
travel_back
end
it 'caches the created_at values' do it 'caches the created_at values' do
::Gitlab::Redis::Cache.with do |redis| ::Gitlab::Redis::Cache.with do |redis|
expect_mget(redis, tags_and_created_ats.keys) expect_mget(redis, tags_and_created_ats.keys)
...@@ -450,32 +443,6 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_ ...@@ -450,32 +443,6 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService, :clean_gitlab_
DateTime.rfc3339(date_time.rfc3339).rfc3339 DateTime.rfc3339(date_time.rfc3339).rfc3339
end end
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 end
private 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