mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
This commit is contained in:
parent
d492c4ed32
commit
d737554758
2 changed files with 29 additions and 3 deletions
|
@ -811,7 +811,7 @@ module LogStash
|
||||||
|
|
||||||
def validate_value
|
def validate_value
|
||||||
# bypass deprecation warning
|
# bypass deprecation warning
|
||||||
validate(wrapped.value) if set?
|
wrapped.validate_value if set?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,15 @@ describe LogStash::Setting::SettingWithDeprecatedAlias do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when only the deprecated alias is set" do
|
context "when only the deprecated alias is set" do
|
||||||
|
|
||||||
|
let(:value) { "crusty_value" }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
settings.set(deprecated_setting_name, "crusty_value")
|
settings.set(deprecated_setting_name, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'resolves to the value provided for the deprecated alias' do
|
it 'resolves to the value provided for the deprecated alias' do
|
||||||
expect(settings.get(canonical_setting_name)).to eq("crusty_value")
|
expect(settings.get(canonical_setting_name)).to eq(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'logs a deprecation warning' do
|
it 'logs a deprecation warning' do
|
||||||
|
@ -69,6 +72,29 @@ describe LogStash::Setting::SettingWithDeprecatedAlias do
|
||||||
end
|
end
|
||||||
|
|
||||||
include_examples '#validate_value success'
|
include_examples '#validate_value success'
|
||||||
|
|
||||||
|
it 'validates deprecated alias' do
|
||||||
|
expect { settings.get_setting(canonical_setting_name).deprecated_alias.validate_value }.to_not raise_error
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'using a boolean setting' do
|
||||||
|
|
||||||
|
let(:value) { true }
|
||||||
|
let(:default_value) { false }
|
||||||
|
|
||||||
|
let(:canonical_setting) { LogStash::Setting::Boolean.new(canonical_setting_name, default_value, true) }
|
||||||
|
|
||||||
|
it 'resolves to the value provided for the deprecated alias' do
|
||||||
|
expect(settings.get(canonical_setting_name)).to eq(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples '#validate_value success'
|
||||||
|
|
||||||
|
it 'validates deprecated alias' do
|
||||||
|
expect { settings.get_setting(canonical_setting_name).deprecated_alias.validate_value }.to_not raise_error
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when only the canonical setting is set" do
|
context "when only the canonical setting is set" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue