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:
Diffstat (limited to 'spec/support/redis')
-rw-r--r--spec/support/redis/redis_helpers.rb34
-rw-r--r--spec/support/redis/redis_shared_examples.rb10
2 files changed, 9 insertions, 35 deletions
diff --git a/spec/support/redis/redis_helpers.rb b/spec/support/redis/redis_helpers.rb
index 90c15dea1f8..34ac69236ee 100644
--- a/spec/support/redis/redis_helpers.rb
+++ b/spec/support/redis/redis_helpers.rb
@@ -1,36 +1,10 @@
# frozen_string_literal: true
module RedisHelpers
- # config/README.md
-
- # Usage: performance enhancement
- def redis_cache_cleanup!
- Gitlab::Redis::Cache.with(&:flushdb)
- end
-
- # Usage: SideKiq, Mailroom, CI Runner, Workhorse, push services
- def redis_queues_cleanup!
- Gitlab::Redis::Queues.with(&:flushdb)
- end
-
- # Usage: session state, rate limiting
- def redis_shared_state_cleanup!
- Gitlab::Redis::SharedState.with(&:flushdb)
- end
-
- # Usage: CI trace chunks
- def redis_trace_chunks_cleanup!
- Gitlab::Redis::TraceChunks.with(&:flushdb)
- end
-
- # Usage: rate limiting state (for Rack::Attack)
- def redis_rate_limiting_cleanup!
- Gitlab::Redis::RateLimiting.with(&:flushdb)
- end
-
- # Usage: session state
- def redis_sessions_cleanup!
- Gitlab::Redis::Sessions.with(&:flushdb)
+ Gitlab::Redis::ALL_CLASSES.each do |instance_class|
+ define_method("redis_#{instance_class.store_name.underscore}_cleanup!") do
+ instance_class.with(&:flushdb)
+ end
end
# Usage: reset cached instance config
diff --git a/spec/support/redis/redis_shared_examples.rb b/spec/support/redis/redis_shared_examples.rb
index d4c8682ec71..33945509675 100644
--- a/spec/support/redis/redis_shared_examples.rb
+++ b/spec/support/redis/redis_shared_examples.rb
@@ -3,19 +3,19 @@
RSpec.shared_examples "redis_shared_examples" do
include StubENV
- let(:test_redis_url) { "redis://redishost:#{redis_port}"}
+ let(:test_redis_url) { "redis://redishost:#{redis_port}" }
let(:config_file_name) { instance_specific_config_file }
let(:config_old_format_socket) { "spec/fixtures/config/redis_old_format_socket.yml" }
let(:config_new_format_socket) { "spec/fixtures/config/redis_new_format_socket.yml" }
- let(:old_socket_path) {"/path/to/old/redis.sock" }
- let(:new_socket_path) {"/path/to/redis.sock" }
+ let(:old_socket_path) { "/path/to/old/redis.sock" }
+ let(:new_socket_path) { "/path/to/redis.sock" }
let(:config_old_format_host) { "spec/fixtures/config/redis_old_format_host.yml" }
let(:config_new_format_host) { "spec/fixtures/config/redis_new_format_host.yml" }
let(:redis_port) { 6379 }
let(:redis_database) { 99 }
let(:sentinel_port) { 26379 }
- let(:config_with_environment_variable_inside) { "spec/fixtures/config/redis_config_with_env.yml"}
- let(:config_env_variable_url) {"TEST_GITLAB_REDIS_URL"}
+ let(:config_with_environment_variable_inside) { "spec/fixtures/config/redis_config_with_env.yml" }
+ let(:config_env_variable_url) { "TEST_GITLAB_REDIS_URL" }
let(:rails_root) { Dir.mktmpdir('redis_shared_examples') }
before do