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>2020-05-20 17:34:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/performance_bar_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/performance_bar_spec.rb')
-rw-r--r--spec/lib/gitlab/performance_bar_spec.rb59
1 files changed, 21 insertions, 38 deletions
diff --git a/spec/lib/gitlab/performance_bar_spec.rb b/spec/lib/gitlab/performance_bar_spec.rb
index 816db49d94a..7b79cc82816 100644
--- a/spec/lib/gitlab/performance_bar_spec.rb
+++ b/spec/lib/gitlab/performance_bar_spec.rb
@@ -3,42 +3,7 @@
require 'spec_helper'
describe Gitlab::PerformanceBar do
- shared_examples 'allowed user IDs are cached' do
- before do
- # Warm the caches
- described_class.enabled_for_user?(user)
- end
-
- it 'caches the allowed user IDs in cache', :use_clean_rails_memory_store_caching do
- expect do
- expect(described_class.l1_cache_backend).to receive(:fetch).and_call_original
- expect(described_class.l2_cache_backend).not_to receive(:fetch)
- expect(described_class.enabled_for_user?(user)).to be_truthy
- end.not_to exceed_query_limit(0)
- end
-
- it 'caches the allowed user IDs in L1 cache for 1 minute', :use_clean_rails_memory_store_caching do
- Timecop.travel 2.minutes do
- expect do
- expect(described_class.l1_cache_backend).to receive(:fetch).and_call_original
- expect(described_class.l2_cache_backend).to receive(:fetch).and_call_original
- expect(described_class.enabled_for_user?(user)).to be_truthy
- end.not_to exceed_query_limit(0)
- end
- end
-
- it 'caches the allowed user IDs in L2 cache for 5 minutes', :use_clean_rails_memory_store_caching do
- Timecop.travel 6.minutes do
- expect do
- expect(described_class.l1_cache_backend).to receive(:fetch).and_call_original
- expect(described_class.l2_cache_backend).to receive(:fetch).and_call_original
- expect(described_class.enabled_for_user?(user)).to be_truthy
- end.not_to exceed_query_limit(2)
- end
- end
- end
-
- it { expect(described_class.l1_cache_backend).to eq(Gitlab::ThreadMemoryCache.cache_backend) }
+ it { expect(described_class.l1_cache_backend).to eq(Gitlab::ProcessMemoryCache.cache_backend) }
it { expect(described_class.l2_cache_backend).to eq(Rails.cache) }
describe '.enabled_for_user?' do
@@ -82,7 +47,16 @@ describe Gitlab::PerformanceBar do
expect(described_class.enabled_for_user?(user)).to be_falsy
end
- it_behaves_like 'allowed user IDs are cached'
+ context 'caching of allowed user IDs' do
+ subject { described_class.enabled_for_user?(user) }
+
+ before do
+ # Warm the caches
+ described_class.enabled_for_user?(user)
+ end
+
+ it_behaves_like 'allowed user IDs are cached'
+ end
end
context 'when user is a member of the allowed group' do
@@ -94,7 +68,16 @@ describe Gitlab::PerformanceBar do
expect(described_class.enabled_for_user?(user)).to be_truthy
end
- it_behaves_like 'allowed user IDs are cached'
+ context 'caching of allowed user IDs' do
+ subject { described_class.enabled_for_user?(user) }
+
+ before do
+ # Warm the caches
+ described_class.enabled_for_user?(user)
+ end
+
+ it_behaves_like 'allowed user IDs are cached'
+ end
end
end