logstash-core 1.5.0.rc3.snapshot6-java → 1.5.0.rc4-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of logstash-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/logstash-core.rb +2 -0
- data/lib/logstash/agent.rb +0 -33
- data/lib/logstash/config/config_ast.rb +1 -1
- data/lib/logstash/environment.rb +8 -30
- data/lib/logstash/filters/base.rb +19 -0
- data/lib/logstash/namespace.rb +0 -1
- data/lib/logstash/runner.rb +3 -51
- data/lib/logstash/version.rb +1 -1
- data/logstash-core.gemspec +54 -0
- data/spec/core/conditionals_spec.rb +428 -0
- data/spec/core/config_mixin_spec.rb +99 -0
- data/spec/core/config_spec.rb +108 -0
- data/spec/core/environment_spec.rb +44 -0
- data/spec/core/event_spec.rb +468 -0
- data/spec/core/pipeline_spec.rb +198 -0
- data/spec/core/plugin_spec.rb +106 -0
- data/spec/core/runner_spec.rb +39 -0
- data/spec/core/timestamp_spec.rb +83 -0
- data/spec/filters/base_spec.rb +318 -0
- data/spec/inputs/base_spec.rb +13 -0
- data/spec/lib/logstash/bundler_spec.rb +120 -0
- data/spec/lib/logstash/java_integration_spec.rb +257 -0
- data/spec/logstash/agent_spec.rb +37 -0
- data/spec/outputs/base_spec.rb +47 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/util/accessors_spec.rb +215 -0
- data/spec/util/charset_spec.rb +74 -0
- data/spec/util/fieldeval_spec.rb +96 -0
- data/spec/util/gemfile_spec.rb +212 -0
- data/spec/util/json_spec.rb +97 -0
- data/spec/util/plugin_version_spec.rb +48 -0
- data/spec/util_spec.rb +34 -0
- metadata +84 -160
- data/lib/logstash-event.rb +0 -2
- data/lib/logstash.rb +0 -4
- data/lib/logstash/bundler.rb +0 -156
- data/lib/logstash/gemfile.rb +0 -193
- data/lib/logstash/pluginmanager.rb +0 -17
- data/lib/logstash/pluginmanager/command.rb +0 -38
- data/lib/logstash/pluginmanager/install.rb +0 -141
- data/lib/logstash/pluginmanager/list.rb +0 -44
- data/lib/logstash/pluginmanager/main.rb +0 -21
- data/lib/logstash/pluginmanager/uninstall.rb +0 -43
- data/lib/logstash/pluginmanager/update.rb +0 -105
- data/lib/logstash/pluginmanager/util.rb +0 -89
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe "LogStash::Inputs::Base#fix_streaming_codecs" do
|
5
|
+
it "should carry the charset setting along when switching" do
|
6
|
+
require "logstash/inputs/tcp"
|
7
|
+
require "logstash/codecs/plain"
|
8
|
+
plain = LogStash::Codecs::Plain.new("charset" => "CP1252")
|
9
|
+
tcp = LogStash::Inputs::Tcp.new("codec" => plain, "port" => 3333)
|
10
|
+
tcp.instance_eval { fix_streaming_codecs }
|
11
|
+
expect(tcp.codec.charset).to eq("CP1252")
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
require "bundler/cli"
|
4
|
+
|
5
|
+
describe LogStash::Bundler do
|
6
|
+
context "capture_stdout" do
|
7
|
+
it "should capture stdout from block" do
|
8
|
+
original_stdout = $stdout
|
9
|
+
output, exception = LogStash::Bundler.capture_stdout do
|
10
|
+
expect($stdout).not_to eq(original_stdout)
|
11
|
+
puts("foobar")
|
12
|
+
end
|
13
|
+
expect($stdout).to eq(original_stdout)
|
14
|
+
expect(output).to eq("foobar\n")
|
15
|
+
expect(exception).to eq(nil)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should capture stdout and report exception from block" do
|
19
|
+
output, exception = LogStash::Bundler.capture_stdout do
|
20
|
+
puts("foobar")
|
21
|
+
raise(StandardError, "baz")
|
22
|
+
end
|
23
|
+
expect(output).to eq("foobar\n")
|
24
|
+
expect(exception).to be_a(StandardError)
|
25
|
+
expect(exception.message).to eq("baz")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when invoking bundler' do
|
30
|
+
original_stderr = $stderr
|
31
|
+
|
32
|
+
subject { LogStash::Bundler.invoke!(options) }
|
33
|
+
# by default we want to fail fast on the test
|
34
|
+
let(:options) { { :install => true, :max_tries => 0, :without => [:development]} }
|
35
|
+
let(:bundler_args) { LogStash::Bundler.bundler_arguments(options) }
|
36
|
+
|
37
|
+
before do
|
38
|
+
$stderr = StringIO.new
|
39
|
+
|
40
|
+
expect(::Bundler).to receive(:reset!).at_least(1)
|
41
|
+
end
|
42
|
+
|
43
|
+
after do
|
44
|
+
expect(::Bundler.settings[:path]).to eq(LogStash::Environment::BUNDLE_DIR)
|
45
|
+
expect(::Bundler.settings[:gemfile]).to eq(LogStash::Environment::GEMFILE_PATH)
|
46
|
+
expect(::Bundler.settings[:without]).to eq(options.fetch(:without, []).join(':'))
|
47
|
+
|
48
|
+
expect(ENV['GEM_PATH']).to eq(LogStash::Environment.logstash_gem_home)
|
49
|
+
|
50
|
+
$stderr = original_stderr
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should call Bundler::CLI.start with the correct arguments' do
|
54
|
+
expect(::Bundler::CLI).to receive(:start).with(bundler_args)
|
55
|
+
LogStash::Bundler.invoke!(options)
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'abort with an exception' do
|
59
|
+
it 'gem conflict' do
|
60
|
+
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::VersionConflict.new('conflict') }
|
61
|
+
expect { subject }.to raise_error(::Bundler::VersionConflict)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'gem is not found' do
|
65
|
+
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::GemNotFound.new('conflict') }
|
66
|
+
expect { subject }.to raise_error(::Bundler::GemNotFound)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'on max retries' do
|
70
|
+
options.merge!({ :max_tries => 2 })
|
71
|
+
expect(::Bundler::CLI).to receive(:start).with(bundler_args).at_most(options[:max_tries] + 1) { raise RuntimeError }
|
72
|
+
expect { subject }.to raise_error(RuntimeError)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when generating bundler arguments' do
|
78
|
+
subject { LogStash::Bundler.bundler_arguments(options) }
|
79
|
+
let(:options) { {} }
|
80
|
+
|
81
|
+
context 'when installing' do
|
82
|
+
let(:options) { { :install => true } }
|
83
|
+
|
84
|
+
it 'should call bundler install' do
|
85
|
+
expect(subject).to include('install')
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'with the cleaning option' do
|
89
|
+
it 'should add the --clean arguments' do
|
90
|
+
options.merge!(:clean => true)
|
91
|
+
expect(subject).to include('install','--clean')
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "when updating" do
|
97
|
+
let(:options) { { :update => 'logstash-input-stdin' } }
|
98
|
+
|
99
|
+
context 'with a specific plugin' do
|
100
|
+
it 'should call `bundle update plugin-name`' do
|
101
|
+
expect(subject).to include('update', 'logstash-input-stdin')
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'with the cleaning option' do
|
106
|
+
it 'should ignore the clean option' do
|
107
|
+
options.merge!(:clean => true)
|
108
|
+
expect(subject).not_to include('--clean')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "when only specifying clean" do
|
114
|
+
let(:options) { { :clean => true } }
|
115
|
+
it 'should call the `bundle clean`' do
|
116
|
+
expect(subject).to include('clean')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
require "logstash/java_integration"
|
4
|
+
|
5
|
+
describe "Java integration" do
|
6
|
+
|
7
|
+
context "type equivalence" do
|
8
|
+
|
9
|
+
# here we test for both is_a? and case/when usage of the Java types
|
10
|
+
# because these are the specific use-cases in our code and the expected
|
11
|
+
# behaviour.
|
12
|
+
|
13
|
+
context "Java::JavaUtil::ArrayList" do
|
14
|
+
|
15
|
+
it "should report to be a Ruby Array" do
|
16
|
+
expect(Java::JavaUtil::ArrayList.new.is_a?(Array)).to be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be class equivalent to Ruby Array" do
|
20
|
+
expect do
|
21
|
+
case Java::JavaUtil::ArrayList.new
|
22
|
+
when Array
|
23
|
+
true
|
24
|
+
else
|
25
|
+
raise
|
26
|
+
end
|
27
|
+
end.not_to raise_error
|
28
|
+
|
29
|
+
expect(Array === Java::JavaUtil::ArrayList.new).to be_true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "Java::JavaUtil::LinkedHashMap" do
|
34
|
+
it "should report to be a Ruby Hash" do
|
35
|
+
expect(Java::JavaUtil::LinkedHashMap.new.is_a?(Hash)).to be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should be class equivalent to Ruby Hash" do
|
39
|
+
expect do
|
40
|
+
case Java::JavaUtil::LinkedHashMap.new
|
41
|
+
when Hash
|
42
|
+
true
|
43
|
+
else
|
44
|
+
raise
|
45
|
+
end
|
46
|
+
end.not_to raise_error
|
47
|
+
|
48
|
+
expect(Hash === Java::JavaUtil::LinkedHashMap.new).to be_true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "Java::JavaUtil::Map" do
|
54
|
+
# this is to test the Java 8 Map interface change for the merge method
|
55
|
+
|
56
|
+
let(:merger){{:a => 1, :b => 2}}
|
57
|
+
let(:mergee){{:b => 3, :c => 4}}
|
58
|
+
|
59
|
+
shared_examples "map merge" do
|
60
|
+
it "should support merging" do
|
61
|
+
expect(subject.merge(mergee)).to eq({:a => 1, :b => 3, :c => 4})
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should return a new hash and not change original hash" do
|
65
|
+
expect{subject.merge(mergee)}.to_not change{subject}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "with Java::JavaUtil::LinkedHashMap" do
|
70
|
+
it_behaves_like "map merge" do
|
71
|
+
subject{Java::JavaUtil::LinkedHashMap.new(merger)}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "with Java::JavaUtil::HashMap" do
|
76
|
+
it_behaves_like "map merge" do
|
77
|
+
subject{Java::JavaUtil::HashMap.new(merger)}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "Java::JavaUtil::Collection" do
|
83
|
+
subject{Java::JavaUtil::ArrayList.new(initial_array)}
|
84
|
+
|
85
|
+
context "when deleting a unique instance" do
|
86
|
+
let(:initial_array) {["foo", "bar"]}
|
87
|
+
|
88
|
+
it "should return the deleted object" do
|
89
|
+
expect(subject.delete("foo")).to eq("foo")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should remove the object to delete" do
|
93
|
+
expect{subject.delete("foo")}.to change{subject.to_a}.from(initial_array).to(["bar"])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "when deleting multiple instances" do
|
98
|
+
let(:initial_array) {["foo", "bar", "foo"]}
|
99
|
+
|
100
|
+
it "should return the last deleted object" do
|
101
|
+
expect(subject.delete("foo")).to eq("foo")
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should remove all the objects to delete" do
|
105
|
+
expect{subject.delete("foo")}.to change{subject.to_a}.from(initial_array).to(["bar"])
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context "when deleting non existing object" do
|
110
|
+
let(:initial_array) {["foo", "bar", "foo"]}
|
111
|
+
|
112
|
+
it "should return nil" do
|
113
|
+
expect(subject.delete("baz")).to be_nil
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should not change the collection" do
|
117
|
+
expect{subject.delete("baz")}.to_not change{subject.to_a}
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should yield to block when given" do
|
121
|
+
expect(subject.delete("baz"){"foobar"}).to eq("foobar")
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context "when deleting on empty collection" do
|
126
|
+
let(:initial_array) {[]}
|
127
|
+
|
128
|
+
it "should return nil" do
|
129
|
+
expect(subject.delete("baz")).to be_nil
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should not change the collection" do
|
133
|
+
expect{subject.delete("baz")}.to_not change{subject.to_a}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context "when intersecting with a Ruby Array" do
|
138
|
+
|
139
|
+
context "using string collection with duplicates and single result" do
|
140
|
+
let(:initial_array) {["foo", "bar", "foo"]}
|
141
|
+
|
142
|
+
it "should not change original collection" do
|
143
|
+
expect{subject & ["foo"]}.to_not change{subject.to_a}
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should return a new array containing elements common to the two arrays, excluding any duplicate" do
|
147
|
+
expect((subject & ["foo"]).to_a).to eq(["foo"])
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "using string collection with duplicates and multiple results" do
|
152
|
+
let(:original) {["foo", "bar", "foo", "baz"]}
|
153
|
+
let(:target) {["baz", "foo"]}
|
154
|
+
let(:result) {["foo", "baz"]}
|
155
|
+
|
156
|
+
it "should return a new array containing elements common to the two arrays, excluding any duplicate and preserve order from the original array" do
|
157
|
+
# this is the Ruby contract
|
158
|
+
expect(original & target).to eq(result)
|
159
|
+
|
160
|
+
# this should work the same
|
161
|
+
expect((Java::JavaUtil::ArrayList.new(original) & target).to_a).to eq(result)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
context "Ruby doc examples" do
|
166
|
+
it "should return a new array containing elements common to the two arrays, excluding any duplicate" do
|
167
|
+
expect(Java::JavaUtil::ArrayList.new(([1, 1, 3, 5]) & [1, 2, 3]).to_a).to eq([1, 3])
|
168
|
+
expect(Java::JavaUtil::ArrayList.new((['a', 'b', 'b', 'z']) & ['a', 'b', 'c']).to_a).to eq(['a', 'b'])
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
context "when unioning with a Ruby Array" do
|
174
|
+
|
175
|
+
context "using string collection with duplicates" do
|
176
|
+
let(:initial_array) {["foo", "bar", "foo"]}
|
177
|
+
|
178
|
+
it "should not change original collection" do
|
179
|
+
expect{subject | ["bar", "baz"]}.to_not change{subject.to_a}
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return a new array by joining excluding any duplicates and preserving the order from the original array" do
|
183
|
+
expect((subject | ["bar", "baz"]).to_a).to eq(["foo", "bar", "baz"])
|
184
|
+
end
|
185
|
+
|
186
|
+
it "should remove duplicates when joining empty array" do
|
187
|
+
expect((subject | []).to_a).to eq(["foo", "bar"])
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "Ruby doc examples" do
|
192
|
+
it "should return a new array containing elements common to the two arrays, excluding any duplicate" do
|
193
|
+
expect(Java::JavaUtil::ArrayList.new((["a", "b", "c"]) | ["c", "d", "a"]).to_a).to eq(["a", "b", "c", "d"])
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
context "Enumerable implementation" do
|
200
|
+
context "Java Map interface should report key with nil value as included" do
|
201
|
+
|
202
|
+
it "should support include? method" do
|
203
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => nil}).include?("foo")).to be_true
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should support has_key? method" do
|
207
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => nil}).has_key?("foo")).to be_true
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should support member? method" do
|
211
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => nil}).member?("foo")).to be_true
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should support key? method" do
|
215
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => nil}).key?("foo")).to be_true
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
context "Java Map interface should report key with a value as included" do
|
220
|
+
|
221
|
+
it "should support include? method" do
|
222
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).include?("foo")).to be_true
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should support has_key? method" do
|
226
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).has_key?("foo")).to be_true
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should support member? method" do
|
230
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).member?("foo")).to be_true
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should support key? method" do
|
234
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).key?("foo")).to be_true
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
context "Java Map interface should report non existing key as not included" do
|
239
|
+
|
240
|
+
it "should support include? method" do
|
241
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).include?("bar")).to be_false
|
242
|
+
end
|
243
|
+
|
244
|
+
it "should support has_key? method" do
|
245
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).has_key?("bar")).to be_false
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should support member? method" do
|
249
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).member?("bar")).to be_false
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should support key? method" do
|
253
|
+
expect(Java::JavaUtil::LinkedHashMap.new({"foo" => 1}).key?("bar")).to be_false
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LogStash::Agent do
|
4
|
+
subject { LogStash::Agent.new('') }
|
5
|
+
let(:dummy_config) { 'input {}' }
|
6
|
+
|
7
|
+
context "when loading the configuration" do
|
8
|
+
context "when local" do
|
9
|
+
before { expect(subject).to receive(:local_config).with(path) }
|
10
|
+
|
11
|
+
context "unix" do
|
12
|
+
let(:path) { './test.conf' }
|
13
|
+
it 'works with relative path' do
|
14
|
+
subject.load_config(path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "windows" do
|
19
|
+
let(:path) { '.\test.conf' }
|
20
|
+
it 'work with relative windows path' do
|
21
|
+
subject.load_config(path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when remote" do
|
27
|
+
context 'supported scheme' do
|
28
|
+
let(:path) { "http://test.local/superconfig.conf" }
|
29
|
+
|
30
|
+
before { expect(Net::HTTP).to receive(:get) { dummy_config } }
|
31
|
+
it 'works with http' do
|
32
|
+
expect(subject.load_config(path)).to eq("#{dummy_config}\n")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
# use a dummy NOOP output to test Outputs::Base
|
5
|
+
class LogStash::Outputs::NOOP < LogStash::Outputs::Base
|
6
|
+
config_name "noop"
|
7
|
+
milestone 2
|
8
|
+
|
9
|
+
config :dummy_option, :validate => :string
|
10
|
+
|
11
|
+
def register; end
|
12
|
+
|
13
|
+
def receive(event)
|
14
|
+
return output?(event)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "LogStash::Outputs::Base#worker_setup" do
|
19
|
+
it "should create workers using original parameters except workers = 1" do
|
20
|
+
params = { "dummy_option" => "potatoes", "codec" => "json", "workers" => 2 }
|
21
|
+
worker_params = params.dup; worker_params["workers"] = 1
|
22
|
+
output = LogStash::Outputs::NOOP.new(params.dup)
|
23
|
+
expect(LogStash::Outputs::NOOP).to receive(:new).twice.with(worker_params).and_call_original
|
24
|
+
output.worker_setup
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "LogStash::Outputs::Base#output?" do
|
29
|
+
it "should filter by type" do
|
30
|
+
output = LogStash::Outputs::NOOP.new("type" => "noop")
|
31
|
+
expect(output.receive(LogStash::Event.new({"type" => "noop"}))).to eq(true)
|
32
|
+
expect(output.receive(LogStash::Event.new({"type" => "not_noop"}))).to eq(false)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should filter by tags" do
|
36
|
+
output = LogStash::Outputs::NOOP.new("tags" => ["value", "value2"])
|
37
|
+
expect(output.receive(LogStash::Event.new({"tags" => ["value","value2"]}))).to eq(true)
|
38
|
+
expect(output.receive(LogStash::Event.new({"tags" => ["notvalue"]}))).to eq(false)
|
39
|
+
expect(output.receive(LogStash::Event.new({"tags" => ["value"]}))).to eq(false)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should exclude by tags" do
|
43
|
+
output = LogStash::Outputs::NOOP.new("exclude_tags" => ["value"])
|
44
|
+
expect(output.receive(LogStash::Event.new({"tags" => ["value"]}))).to eq(false)
|
45
|
+
expect(output.receive(LogStash::Event.new({"tags" => ["notvalue"]}))).to eq(true)
|
46
|
+
end
|
47
|
+
end
|