diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-03 21:11:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-03 21:11:16 +0300 |
commit | 9578c9f9e88421a5dc4d9215f40d932bd30cbabc (patch) | |
tree | 51cc56403430f901de45cb82a6ab5f63c1f37712 /spec/tasks | |
parent | 7fcda12793acc54ba8de037f50cc3696dbd0f002 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/cache/clear/redis_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/tasks/cache/clear/redis_spec.rb b/spec/tasks/cache/clear/redis_spec.rb index d2de068f254..2c0a5dcd54d 100644 --- a/spec/tasks/cache/clear/redis_spec.rb +++ b/spec/tasks/cache/clear/redis_spec.rb @@ -2,7 +2,7 @@ require 'rake_helper' -RSpec.describe 'clearing redis cache' do +RSpec.describe 'clearing redis cache', :clean_gitlab_redis_cache do before do Rake.application.rake_require 'tasks/cache' end @@ -21,4 +21,27 @@ RSpec.describe 'clearing redis cache' do expect { run_rake_task('cache:clear:redis') }.to change { pipeline_status.has_cache? } end end + + describe 'invoking clear description templates cache rake task' do + using RSpec::Parameterized::TableSyntax + + before do + stub_env('project_ids', project_ids) if project_ids + service = double(:service, execute: true) + + expect(Gitlab::Cleanup::Redis::DescriptionTemplatesCacheKeysPatternBuilder).to receive(:new).with(expected_project_ids).and_return(service) + expect(Gitlab::Cleanup::Redis::BatchDeleteByPattern).to receive(:new).and_return(service) + end + + where(:project_ids, :expected_project_ids) do + nil | [] # this acts as no argument is being passed + '1' | %w[1] + '1, 2, 3' | %w[1 2 3] + '1, 2, some-string, 3' | %w[1 2 some-string 3] + end + + with_them do + specify { run_rake_task('cache:clear:description_templates') } + end + end end |