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-02-28 00:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 00:09:17 +0300
commitc77fda905a8619b756163c10a75171dc9cfe7084 (patch)
treeffa93b37bfe4b99ba0b8584c7a0bd1a4cd19772a /spec/lib/gitlab
parente0fa0638a422c3e20d4423c9bb69d79afc9c7d3d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/grape_logging/formatters/lograge_with_timestamp_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/lib/gitlab/grape_logging/formatters/lograge_with_timestamp_spec.rb b/spec/lib/gitlab/grape_logging/formatters/lograge_with_timestamp_spec.rb
new file mode 100644
index 00000000000..d3b108f60ff
--- /dev/null
+++ b/spec/lib/gitlab/grape_logging/formatters/lograge_with_timestamp_spec.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp do
+ let(:log_entry) do
+ {
+ status: 200,
+ time: {
+ total: 758.58,
+ db: 77.06,
+ view: 681.52
+ },
+ method: 'PUT',
+ path: '/api/v4/projects/1',
+ params: {
+ 'description': '[FILTERED]',
+ 'name': 'gitlab test'
+ },
+ host: 'localhost',
+ remote_ip: '127.0.0.1',
+ ua: 'curl/7.66.0',
+ route: '/api/:version/projects/:id',
+ user_id: 1,
+ username: 'root',
+ queue_duration: 1764.06,
+ gitaly_calls: 6,
+ gitaly_duration: 20.0,
+ correlation_id: 'WMefXn60429'
+ }
+ end
+ let(:time) { Time.now }
+ let(:result) { JSON.parse(subject) }
+
+ subject { described_class.new.call(:info, time, nil, log_entry) }
+
+ it 'turns the log entry to valid JSON' do
+ expect(result['status']).to eq(200)
+ end
+
+ it 're-formats the params hash' do
+ params = result['params']
+
+ expect(params).to eq([
+ { 'key' => 'description', 'value' => '[FILTERED]' },
+ { 'key' => 'name', 'value' => 'gitlab test' }
+ ])
+ end
+end