mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
prevent DeprecatedRemovedSetting from fatally stopping logstash (#10657)
This commit is contained in:
parent
4a27b4c264
commit
5d60dc9e8c
2 changed files with 3 additions and 18 deletions
|
@ -598,11 +598,7 @@ module LogStash
|
|||
end
|
||||
|
||||
def set(value)
|
||||
fail(RuntimeError, "The setting `#{name}` has been deprecated and removed from Logstash; #{@guidance}")
|
||||
end
|
||||
|
||||
def value
|
||||
fail(ArgumentError, "The setting `#{name}` has been deprecated and removed from Logstash")
|
||||
fail(ArgumentError, "The setting `#{name}` has been deprecated and removed from Logstash; #{@guidance}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -9,22 +9,11 @@ describe LogStash::Setting::DeprecatedAndRenamed do
|
|||
describe '#set' do
|
||||
it 'fails with deprecation runtime error and helpful guidance' do
|
||||
expect { setting.set(value) }.to raise_exception do |exception|
|
||||
expect(exception).to be_a_kind_of(RuntimeError)
|
||||
expect(exception).to be_a_kind_of(ArgumentError)
|
||||
expect(exception.message).to match(/deprecated and removed/)
|
||||
expect(exception.message).to include("option.deprecated")
|
||||
expect(exception.message).to include("option.current")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#value' do
|
||||
it 'fails with deprecation argument error' do
|
||||
expect { setting.value }.to raise_exception do |exception|
|
||||
expect(exception).to be_a_kind_of(ArgumentError)
|
||||
expect(exception.message).to match(/deprecated and removed/)
|
||||
expect(exception.message).to include("option.deprecated")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue