Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Commit

Permalink
Add tests for deep nested env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
suyograo committed Feb 21, 2017
1 parent efc0a0c commit e2ffcf9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion logstash-core/spec/logstash/config/mixin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@
config :oneNumber, :validate => :number, :required => false
config :oneArray, :validate => :array, :required => false
config :oneHash, :validate => :hash, :required => false
config :nestedHash, :validate => :hash, :required => false
config :nestedArray, :validate => :hash, :required => false
config :deepHash, :validate => :hash, :required => false

def initialize(params)
super(params)
Expand Down Expand Up @@ -378,7 +381,10 @@ def initialize(params)
"oneString" => "${FunString:foo}",
"oneBoolean" => "${FunBool:false}",
"oneArray" => [ "first array value", "${FunString:foo}" ],
"oneHash" => { "key1" => "${FunString:foo}", "key2" => "${FunString} is ${FunBool}", "key3" => "${FunBool:false} or ${funbool:false}" }
"oneHash" => { "key1" => "${FunString:foo}", "key2" => "${FunString} is ${FunBool}", "key3" => "${FunBool:false} or ${funbool:false}" },
"nestedHash" => { "level1" => { "key1" => "http://${FunString}:8080/blah.txt" } },
"nestedArray" => { "level1" => [{ "key1" => "http://${FunString}:8080/blah.txt" }, { "key2" => "http://${FunString}:8080/foo.txt" }] },
"deepHash" => { "level1" => { "level2" => {"level3" => { "key1" => "http://${FunString}:8080/blah.txt" } } } }
)
end

Expand All @@ -387,6 +393,9 @@ def initialize(params)
expect(subject.oneBoolean).to(be_truthy)
expect(subject.oneArray).to(be == [ "first array value", "fancy" ])
expect(subject.oneHash).to(be == { "key1" => "fancy", "key2" => "fancy is true", "key3" => "true or false" })
expect(subject.nestedHash).to(be == { "level1" => { "key1" => "http://fancy:8080/blah.txt" } })
expect(subject.nestedArray).to(be == { "level1" => [{ "key1" => "http://fancy:8080/blah.txt" }, { "key2" => "http://fancy:8080/foo.txt" }] })
expect(subject.deepHash).to(be == { "level1" => { "level2" => { "level3" => { "key1" => "http://fancy:8080/blah.txt" } } } })
end
end

Expand Down

0 comments on commit e2ffcf9

Please sign in to comment.