Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 21:25:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 21:25:58 +0300
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /spec/tasks/cache/clear/redis_spec.rb
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/tasks/cache/clear/redis_spec.rb')
-rw-r--r--spec/tasks/cache/clear/redis_spec.rb39
1 files changed, 38 insertions, 1 deletions
diff --git a/spec/tasks/cache/clear/redis_spec.rb b/spec/tasks/cache/clear/redis_spec.rb
index d2de068f254..64ed83c649b 100644
--- a/spec/tasks/cache/clear/redis_spec.rb
+++ b/spec/tasks/cache/clear/redis_spec.rb
@@ -2,11 +2,15 @@
require 'rake_helper'
-RSpec.describe 'clearing redis cache' do
+RSpec.describe 'clearing redis cache', :clean_gitlab_redis_cache, :silence_stdout do
before do
Rake.application.rake_require 'tasks/cache'
end
+ shared_examples 'clears the cache' do
+ it { expect { run_rake_task('cache:clear:redis') }.to change { redis_keys.size }.by(-1) }
+ end
+
describe 'clearing pipeline status cache' do
let(:pipeline_status) do
project = create(:project, :repository)
@@ -20,5 +24,38 @@ RSpec.describe 'clearing redis cache' do
it 'clears pipeline status cache' do
expect { run_rake_task('cache:clear:redis') }.to change { pipeline_status.has_cache? }
end
+
+ it_behaves_like 'clears the cache'
+ end
+
+ describe 'clearing set caches' do
+ context 'repository set' do
+ let(:project) { create(:project) }
+ let(:repository) { project.repository }
+
+ let(:cache) { Gitlab::RepositorySetCache.new(repository) }
+
+ before do
+ pending "Enable as part of https://gitlab.com/gitlab-org/gitlab/-/issues/331319"
+
+ cache.write(:foo, [:bar])
+ end
+
+ it_behaves_like 'clears the cache'
+ end
+
+ context 'reactive cache set' do
+ let(:cache) { Gitlab::ReactiveCacheSetCache.new }
+
+ before do
+ cache.write(:foo, :bar)
+ end
+
+ it_behaves_like 'clears the cache'
+ end
+ end
+
+ def redis_keys
+ Gitlab::Redis::Cache.with { |redis| redis.scan(0, match: "*") }.last
end
end