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-03-24 21:07:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 21:07:55 +0300
commit603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (patch)
tree907f5b8ee1b6f5aad396e95e3327a08400b9e8ea /spec/lib/gitlab/grape_logging
parent120f4aaedc8fe830a3f572491d240d8ee6addefb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/grape_logging')
-rw-r--r--spec/lib/gitlab/grape_logging/loggers/perf_logger_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/grape_logging/loggers/perf_logger_spec.rb b/spec/lib/gitlab/grape_logging/loggers/perf_logger_spec.rb
new file mode 100644
index 00000000000..6f20b8877e0
--- /dev/null
+++ b/spec/lib/gitlab/grape_logging/loggers/perf_logger_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::GrapeLogging::Loggers::PerfLogger do
+ subject { described_class.new }
+
+ describe ".parameters" do
+ let(:mock_request) { OpenStruct.new(env: {}) }
+
+ describe 'when no performance datais are present' do
+ it 'returns an empty Hash' do
+ expect(subject.parameters(mock_request, nil)).to eq({})
+ end
+ end
+
+ describe 'when Redis calls are present', :request_store do
+ it 'returns a Hash with Redis information' do
+ Gitlab::Redis::SharedState.with { |redis| redis.get('perf-logger-test') }
+
+ payload = subject.parameters(mock_request, nil)
+
+ expect(payload[:redis_calls]).to eq(1)
+ expect(payload[:redis_duration_ms]).to be >= 0
+ end
+ end
+ end
+end