Skip to content
代码片段 群组 项目
未验证 提交 d59d53f6 编辑于 作者: Bogdan Denkovych's avatar Bogdan Denkovych
浏览文件

Recover deprecation behavior for current rails version

上级 97e3a7a3
No related branches found
No related tags found
无相关合并请求
......@@ -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
......
# 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
......@@ -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' }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册