diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-09 21:12:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-09 21:12:44 +0300 |
commit | 26dd7eec86080ea304eae663500455b96bbcfa1b (patch) | |
tree | 7ed2608f60ce7805a9ead423d747b9439476bbe8 /spec | |
parent | 0eb9c236888a832407bf0369ce188c4060a35c76 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-ee
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/grape_logging/loggers/response_logger_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/lograge/custom_options_spec.rb | 10 |
3 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 0beaae7a2d7..58125f3a831 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -567,6 +567,20 @@ RSpec.describe ApplicationController, feature_category: :shared do expect(controller.last_payload[:response_bytes]).to eq('authenticated'.bytesize) end + + context 'with log_response_length disabled' do + before do + stub_feature_flags(log_response_length: false) + end + + it 'logs response length' do + sign_in user + + get :index + + expect(controller.last_payload).not_to include(:response_bytes) + end + end end describe '#access_denied' do diff --git a/spec/lib/gitlab/grape_logging/loggers/response_logger_spec.rb b/spec/lib/gitlab/grape_logging/loggers/response_logger_spec.rb index 1bf97e87708..449096a6faf 100644 --- a/spec/lib/gitlab/grape_logging/loggers/response_logger_spec.rb +++ b/spec/lib/gitlab/grape_logging/loggers/response_logger_spec.rb @@ -20,6 +20,14 @@ RSpec.describe Gitlab::GrapeLogging::Loggers::ResponseLogger do it { expect(subject).to eq({ response_bytes: response1.bytesize + response2.bytesize }) } end + context 'with log_response_length disabled' do + before do + stub_feature_flags(log_response_length: false) + end + + it { expect(subject).to eq({}) } + end + context 'when response is a String' do let(:response) { response1 } diff --git a/spec/lib/gitlab/lograge/custom_options_spec.rb b/spec/lib/gitlab/lograge/custom_options_spec.rb index 3460a8fb080..090b79c5d3c 100644 --- a/spec/lib/gitlab/lograge/custom_options_spec.rb +++ b/spec/lib/gitlab/lograge/custom_options_spec.rb @@ -60,6 +60,16 @@ RSpec.describe Gitlab::Lograge::CustomOptions 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]) |