diff options
Diffstat (limited to 'spec/lib/gitlab/lograge/custom_options_spec.rb')
-rw-r--r-- | spec/lib/gitlab/lograge/custom_options_spec.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/lib/gitlab/lograge/custom_options_spec.rb b/spec/lib/gitlab/lograge/custom_options_spec.rb index 58b05be6ff9..090b79c5d3c 100644 --- a/spec/lib/gitlab/lograge/custom_options_spec.rb +++ b/spec/lib/gitlab/lograge/custom_options_spec.rb @@ -25,7 +25,8 @@ RSpec.describe Gitlab::Lograge::CustomOptions do remote_ip: '192.168.1.2', ua: 'Nyxt', queue_duration_s: 0.2, - etag_route: '/etag' + etag_route: '/etag', + response_bytes: 1234 } end @@ -55,6 +56,20 @@ RSpec.describe Gitlab::Lograge::CustomOptions do expect(subject[:user_id]).to eq('test') end + it 'adds the response length' do + expect(subject[:response_bytes]).to eq(1234) + end + + context 'with log_response_length disabled' do + before do + stub_feature_flags(log_response_length: false) + end + + it 'does not add the response length' do + expect(subject).not_to include(:response_bytes) + end + end + it 'adds Cloudflare headers' do expect(subject[:cf_ray]).to eq(event.payload[:cf_ray]) expect(subject[:cf_request_id]).to eq(event.payload[:cf_request_id]) |