Skip to content

Commit

Permalink
Test: multiple UNIXPATH behavior
Browse files Browse the repository at this point in the history
adapted matching behavior (extracted from logstash-plugins#13)

NOTE: original fix does not really resolve logstash-plugins#13
06de0c1
  • Loading branch information
kares committed Nov 26, 2020
1 parent 832b1ff commit f462db0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions spec/patterns/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,23 @@

context "when using comma separators and other regexp" do

let(:pattern) { '((a=(?<a>%{UNIXPATH})?|b=(?<b>%{UNIXPATH})?)(,\s)?)+' }

let(:grok) do
grok = LogStash::Filters::Grok.new("match" => ["message", pattern])
grok.register
grok
end

let(:value) { 'a=/some/path, b=/some/other/path' }

it "should match the path" do
expect(grok_match(pattern,value)).to pass
it "should match both paths" do # but does not
event = build_event(value)
grok.filter(event)
expect( event.to_hash['a'] ).to eql '/some/path,'
expect( event.to_hash['b'] ).to be nil
end

end

context "dotted path" do
Expand Down

0 comments on commit f462db0

Please sign in to comment.