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-09 09:10:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-09 09:10:29 +0300
commita5628d3b6d9b74f5902f790ceddd6374148c9d71 (patch)
tree3f62d7996083daa0eae175beea397ec0e0d490ed /spec/lib/gitlab/redis
parentbd02c91f731fd4a02fd44f72b06f6e5f33625065 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/redis')
-rw-r--r--spec/lib/gitlab/redis/trace_chunks_spec.rb55
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/lib/gitlab/redis/trace_chunks_spec.rb b/spec/lib/gitlab/redis/trace_chunks_spec.rb
new file mode 100644
index 00000000000..e974dc519d6
--- /dev/null
+++ b/spec/lib/gitlab/redis/trace_chunks_spec.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Redis::TraceChunks do
+ let(:instance_specific_config_file) { "config/redis.trace_chunks.yml" }
+ let(:environment_config_file_name) { "GITLAB_REDIS_TRACE_CHUNKS_CONFIG_FILE" }
+ let(:shared_state_config_file) { nil }
+
+ before do
+ allow(Gitlab::Redis::SharedState).to receive(:config_file_name).and_return(shared_state_config_file)
+ end
+
+ include_examples "redis_shared_examples"
+
+ describe '.config_file_name' do
+ subject { described_class.config_file_name }
+
+ let(:rails_root) { Dir.mktmpdir('redis_shared_examples') }
+
+ before do
+ # Undo top-level stub of config_file_name because we are testing that method now.
+ allow(described_class).to receive(:config_file_name).and_call_original
+
+ allow(described_class).to receive(:rails_root).and_return(rails_root)
+ FileUtils.mkdir_p(File.join(rails_root, 'config'))
+ end
+
+ after do
+ FileUtils.rm_rf(rails_root)
+ end
+
+ context 'when there is only a resque.yml' do
+ before do
+ FileUtils.touch(File.join(rails_root, 'config/resque.yml'))
+ end
+
+ it { expect(subject).to eq("#{rails_root}/config/resque.yml") }
+
+ context 'and there is a global env override' do
+ before do
+ stub_env('GITLAB_REDIS_CONFIG_FILE', 'global override')
+ end
+
+ it { expect(subject).to eq('global override') }
+
+ context 'and SharedState has a different config file' do
+ let(:shared_state_config_file) { 'shared state config file' }
+
+ it { expect(subject).to eq('shared state config file') }
+ end
+ end
+ end
+ end
+end