6785 test windows style interpolation

Fixes #7072
This commit is contained in:
Armin 2017-05-11 14:15:32 +02:00 committed by Armin Braun
parent 9f1d889c27
commit 6bf4eddaff

View file

@ -160,12 +160,14 @@ describe LogStash::Settings do
settings = described_class.new
settings.register(LogStash::Setting::String.new("interpolated", "missing"))
settings.register(LogStash::Setting::String.new("with_dot", "missing"))
settings.register(LogStash::Setting::String.new("windows_notation", "missing"))
settings
end
let(:values) {{
"interpolated" => "${SOME_LOGSTASH_SPEC_ENV_VAR}",
"with_dot" => "${some.logstash.spec.env.var}"
"with_dot" => "${some.logstash.spec.env.var}",
"windows_notation" => "%SOME_LOGSTASH_SPEC_ENV_VAR%",
}}
let(:yaml_path) do
p = Stud::Temporary.pathname
@ -180,11 +182,13 @@ describe LogStash::Settings do
it "can interpolate environment into settings" do
expect(subject.get('interpolated')).to eq("missing")
expect(subject.get('with_dot')).to eq("missing")
expect(subject.get('windows_notation')).to eq("missing")
ENV['SOME_LOGSTASH_SPEC_ENV_VAR'] = "correct_setting"
ENV['some.logstash.spec.env.var'] = "correct_setting_for_dotted"
subject.from_yaml(yaml_path)
expect(subject.get('interpolated')).to eq("correct_setting")
expect(subject.get('with_dot')).to eq("correct_setting_for_dotted")
expect(subject.get('windows_notation')).to eq("correct_setting")
end
end
end