diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/lib/gitlab/lograge/custom_options_spec.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/lograge/custom_options_spec.rb')
-rw-r--r-- | spec/lib/gitlab/lograge/custom_options_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/lib/gitlab/lograge/custom_options_spec.rb b/spec/lib/gitlab/lograge/custom_options_spec.rb index 9daedfc37e4..a4ae39a835a 100644 --- a/spec/lib/gitlab/lograge/custom_options_spec.rb +++ b/spec/lib/gitlab/lograge/custom_options_spec.rb @@ -19,7 +19,13 @@ RSpec.describe Gitlab::Lograge::CustomOptions do user_id: 'test', cf_ray: SecureRandom.hex, cf_request_id: SecureRandom.hex, - metadata: { 'meta.user' => 'jane.doe' } + metadata: { 'meta.user' => 'jane.doe' }, + request_urgency: :default, + target_duration_s: 1, + remote_ip: '192.168.1.2', + ua: 'Nyxt', + queue_duration_s: 0.2, + etag_route: '/etag' } end @@ -66,6 +72,18 @@ RSpec.describe Gitlab::Lograge::CustomOptions do end end + context 'trusted payload' do + it { is_expected.to include(event_payload.slice(*described_class::KNOWN_PAYLOAD_PARAMS)) } + + context 'payload with rejected fields' do + let(:event_payload) { { params: {}, request_urgency: :high, something: 'random', username: nil } } + + it { is_expected.to include({ request_urgency: :high }) } + it { is_expected.not_to include({ something: 'random' }) } + it { is_expected.not_to include({ username: nil }) } + end + end + context 'when correlation_id is overridden' do let(:correlation_id_key) { Labkit::Correlation::CorrelationId::LOG_KEY } |