prevent DeprecatedRemovedSetting from fatally stopping logstash (#10657)

This commit is contained in:
João Duarte 2019-04-05 12:19:30 +01:00 committed by Joao Duarte
parent 4a27b4c264
commit 5d60dc9e8c
No known key found for this signature in database
GPG key ID: 8700DB5CB64475C9
2 changed files with 3 additions and 18 deletions

View file

@ -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

View file

@ -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