From 4b30aec0aa9e52d3d7d4394f05a725d14e0c0db3 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 9 Apr 2018 20:41:55 +0800 Subject: Allow `rake cache:clear` clearing pipeline status cache * Use the correct key prefix * Clear old cache keys TODO: At some point we could remove clearing old cache keys. --- spec/tasks/cache/clear/redis_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/tasks/cache/clear/redis_spec.rb (limited to 'spec/tasks') diff --git a/spec/tasks/cache/clear/redis_spec.rb b/spec/tasks/cache/clear/redis_spec.rb new file mode 100644 index 00000000000..cca2b864e9b --- /dev/null +++ b/spec/tasks/cache/clear/redis_spec.rb @@ -0,0 +1,19 @@ +require 'rake_helper' + +describe 'clearing redis cache' do + before do + Rake.application.rake_require 'tasks/cache' + end + + describe 'clearing pipeline status cache' do + let(:pipeline_status) { create(:ci_pipeline).project.pipeline_status } + + before do + allow(pipeline_status).to receive(:loaded).and_return(nil) + end + + it 'clears pipeline status cache' do + expect { run_rake_task('cache:clear:redis') }.to change { pipeline_status.has_cache? } + end + end +end -- cgit v1.2.3