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/lib/gitlab/instrumentation_helper_spec.rb')
-rw-r--r--spec/lib/gitlab/instrumentation_helper_spec.rb45
1 files changed, 11 insertions, 34 deletions
diff --git a/spec/lib/gitlab/instrumentation_helper_spec.rb b/spec/lib/gitlab/instrumentation_helper_spec.rb
index ce67d1d0297..8a88328e0c1 100644
--- a/spec/lib/gitlab/instrumentation_helper_spec.rb
+++ b/spec/lib/gitlab/instrumentation_helper_spec.rb
@@ -5,7 +5,7 @@ require 'rspec-parameterized'
require 'support/helpers/rails_helpers'
RSpec.describe Gitlab::InstrumentationHelper, :clean_gitlab_redis_repository_cache, :clean_gitlab_redis_cache,
- feature_category: :scalability do
+ :use_null_store_as_repository_cache, feature_category: :scalability do
using RSpec::Parameterized::TableSyntax
describe '.add_instrumentation_data', :request_store do
@@ -23,42 +23,19 @@ RSpec.describe Gitlab::InstrumentationHelper, :clean_gitlab_redis_repository_cac
expect(payload).to include(db_count: 0, db_cached_count: 0, db_write_count: 0)
end
- shared_examples 'make Gitaly calls' do
- context 'when Gitaly calls are made' do
- it 'adds Gitaly and Redis data' do
- project = create(:project)
- RequestStore.clear!
- project.repository.exists?
+ context 'when Gitaly calls are made' do
+ it 'adds Gitaly and Redis data' do
+ project = create(:project)
+ RequestStore.clear!
+ project.repository.exists?
- subject
-
- expect(payload[:gitaly_calls]).to eq(1)
- expect(payload[:gitaly_duration_s]).to be >= 0
- # With MultiStore, the number of `redis_calls` depends on whether primary_store
- # (Gitlab::Redis::Repositorycache) and secondary_store (Gitlab::Redis::Cache) are of the same instance.
- # In GitLab.com CI, primary and secondary are the same instance, thus only 1 call being made. If primary
- # and secondary are different instances, an additional fallback read to secondary_store will be made because
- # the first `get` call is a cache miss. Then, the following expect will fail.
- expect(payload[:redis_calls]).to eq(1)
- expect(payload[:redis_duration_ms]).to be_nil
- end
- end
- end
-
- context 'when multistore ff use_primary_and_secondary_stores_for_repository_cache is enabled' do
- before do
- stub_feature_flags(use_primary_and_secondary_stores_for_repository_cache: true)
- end
-
- it_behaves_like 'make Gitaly calls'
- end
+ subject
- context 'when multistore ff use_primary_and_secondary_stores_for_repository_cache is disabled' do
- before do
- stub_feature_flags(use_primary_and_secondary_stores_for_repository_cache: false)
+ expect(payload[:gitaly_calls]).to eq(1)
+ expect(payload[:gitaly_duration_s]).to be >= 0
+ expect(payload[:redis_calls]).to eq(nil)
+ expect(payload[:redis_duration_ms]).to be_nil
end
-
- it_behaves_like 'make Gitaly calls'
end
context 'when Redis calls are made' do