diff --git a/bundler.d/test.rb b/bundler.d/test.rb index 765fe984c23..8975b23bac1 100644 --- a/bundler.d/test.rb +++ b/bundler.d/test.rb @@ -15,4 +15,5 @@ gem 'test_after_commit', '>= 0.4', '< 2.0' gem 'shoulda-matchers', '~> 3.0' gem 'shoulda-context', '~> 1.2' + gem 'as_deprecation_tracker', '~> 1.4' end diff --git a/config/as_deprecation_whitelist.yaml b/config/as_deprecation_whitelist.yaml new file mode 100644 index 00000000000..250e174a7b8 --- /dev/null +++ b/config/as_deprecation_whitelist.yaml @@ -0,0 +1,4 @@ +--- +# http://projects.theforeman.org/issues/7570 +- message: You didn't set `secret_key_base`. Read the upgrade documentation to learn + more about this new config option. diff --git a/config/environments/test.rb b/config/environments/test.rb index 8111f25bb64..ce17cf33caa 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,8 @@ +# Track deprecation warnings in test environment as early as possible, but pause processing of +# deprecations until all plugins are registered (prior to the finisher_hook initializer) to ensure +# the whitelist is fully configured. This is done in the after_initialize block below. +ASDeprecationTracker.pause! + Foreman::Application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -62,4 +67,15 @@ config.active_support.test_order = :random config.webpack.dev_server.enabled = false + + # Whitelist all plugin engines by default from raising errors on deprecation warnings for + # compatibility, allow them to override it by adding an ASDT configuration file. + config.after_initialize do + Foreman::Plugin.all.each do |plugin| + unless File.exist?(File.join(plugin.path, 'config', 'as_deprecation_whitelist.yaml')) + ASDeprecationTracker.whitelist.add(engine: plugin.id.to_s.gsub('-', '_')) + end + end + ASDeprecationTracker.resume! + end end diff --git a/config/initializers/deprecations.rb b/config/initializers/deprecations.rb new file mode 100644 index 00000000000..67703bf677b --- /dev/null +++ b/config/initializers/deprecations.rb @@ -0,0 +1 @@ +ActiveSupport::Deprecation.behavior = :silence if Rails.env.production?