diff --git a/config/initializers/00_deprecations.rb b/config/initializers/00_deprecations.rb index 7400cd0be3e60825cb3f72ac9812916303acfabf..315d319e5b23c041f081210357c776809053edbc 100644 --- a/config/initializers/00_deprecations.rb +++ b/config/initializers/00_deprecations.rb @@ -44,13 +44,15 @@ deprecators.disallowed_warnings = rails7_deprecation_warnings + view_component_3_warnings if ::Gitlab.next_rails? - Rails.application.deprecators.behavior = ->(message, callstack, deprecator) do + deprecators.behavior = ->(message, callstack, deprecator) do if ignored_warnings.none? { |warning| warning.match?(message) } ActiveSupport::Deprecation::DEFAULT_BEHAVIORS.slice(:stderr, :notify).each_value do |behavior| behavior.call(message, callstack, deprecator) end end end + else + deprecators.behavior = [:stderr, :notify] end end diff --git a/config/initializers/deprecations.rb b/config/initializers/deprecations.rb index ae857f83fca093dff343cec5d55e410ec37dfc5c..5cc7e78a69d89e20020338c146c18c5847e39d49 100644 --- a/config/initializers/deprecations.rb +++ b/config/initializers/deprecations.rb @@ -1,16 +1,11 @@ # frozen_string_literal: true if Rails.env.development? || ENV['GITLAB_LEGACY_PATH_LOG_MESSAGE'] - deprecator = - if ::Gitlab.next_rails? - ActiveSupport::Deprecation.new('11.0', 'GitLab') - else - ActiveSupport::Deprecation - end + deprecator = ActiveSupport::Deprecation.new('11.0', 'GitLab') deprecator.behavior = ->(message, callstack) { Gitlab::AppLogger.warn("#{message}: #{callstack[1..20].join}") } - deprecator.deprecate_methods(Gitlab::GitalyClient::StorageSettings, :legacy_disk_path, deprecator: deprecator) + deprecator.deprecate_methods(Gitlab::GitalyClient::StorageSettings, :legacy_disk_path) end diff --git a/spec/initializers/00_deprecations_spec.rb b/spec/initializers/00_deprecations_spec.rb index 778dc32d8fb445b8b7ab52dbbb87e548b0f20f5a..f52fa4c09dad26480fe42ec3689702081dde3f51 100644 --- a/spec/initializers/00_deprecations_spec.rb +++ b/spec/initializers/00_deprecations_spec.rb @@ -97,10 +97,7 @@ def load_initializer subject { ActiveSupport::Deprecation.warn('ABC will be removed') } include_examples 'logs to Gitlab::DeprecationJsonLogger', 'DEPRECATION WARNING: ABC will be removed', 'rails' - - context 'when the test is flaky', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/478094' do - include_examples 'logs to stderr', 'DEPRECATION WARNING: ABC will be removed' - end + include_examples 'logs to stderr', 'DEPRECATION WARNING: ABC will be removed' context 'when in production environment' do let(:rails_env) { 'production' }