diff options
Diffstat (limited to 'spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb b/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb index f7731af8dc6..f70621673d5 100644 --- a/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb +++ b/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'when regex matching everything is specified' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex_delete' => '.*' } end @@ -23,6 +23,19 @@ RSpec.shared_examples 'when regex matching everything is specified' do end end +RSpec.shared_examples 'when regex matching everything is specified and latest is not kept' do + |delete_expectations:, service_response_extra: {}, supports_caching: false| + + let(:params) do + { 'name_regex_delete' => '.*', 'keep_latest' => false } + end + + it_behaves_like 'removing the expected tags', + service_response_extra: service_response_extra, + supports_caching: supports_caching, + delete_expectations: delete_expectations +end + RSpec.shared_examples 'when delete regex matching specific tags is used' do |service_response_extra: {}, supports_caching: false| let(:params) do @@ -65,7 +78,7 @@ RSpec.shared_examples 'when delete regex matching specific tags is used with ove end RSpec.shared_examples 'with allow regex value' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex_delete' => '.*', @@ -80,7 +93,7 @@ RSpec.shared_examples 'with allow regex value' do end RSpec.shared_examples 'when keeping only N tags' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex' => 'A|B.*|C', @@ -99,7 +112,7 @@ RSpec.shared_examples 'when keeping only N tags' do end RSpec.shared_examples 'when not keeping N tags' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex' => 'A|B.*|C' } end @@ -115,7 +128,7 @@ RSpec.shared_examples 'when not keeping N tags' do end RSpec.shared_examples 'when removing keeping only 3' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex_delete' => '.*', 'keep_n' => 3 } @@ -128,7 +141,7 @@ RSpec.shared_examples 'when removing keeping only 3' do end RSpec.shared_examples 'when removing older than 1 day' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex_delete' => '.*', @@ -143,7 +156,7 @@ RSpec.shared_examples 'when removing older than 1 day' do end RSpec.shared_examples 'when combining all parameters' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:params) do { 'name_regex_delete' => '.*', @@ -159,7 +172,7 @@ RSpec.shared_examples 'when combining all parameters' do end RSpec.shared_examples 'when running a container_expiration_policy' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| let(:user) { nil } context 'with valid container_expiration_policy param' do @@ -191,7 +204,7 @@ RSpec.shared_examples 'not removing anything' do |service_response_extra: {}, su end RSpec.shared_examples 'removing the expected tags' do - |service_response_extra: {}, supports_caching: false, delete_expectations:| + |delete_expectations:, service_response_extra: {}, supports_caching: false| it 'removes the expected tags' do delete_expectations.each { |expectation| expect_delete(expectation) } expect_no_caching unless supports_caching |