logstash-core 7.1.1-java → 7.2.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -143,6 +143,21 @@ describe LogStashConfigParser do
143
143
 
144
144
  expect(config).to be_nil
145
145
  end
146
+
147
+ it "supports octal literals" do
148
+ parser = LogStashConfigParser.new
149
+ config = parser.parse(%q(
150
+ input {
151
+ example {
152
+ foo => 010
153
+ }
154
+ }
155
+ ))
156
+
157
+ compiled_number = eval(config.recursive_select(LogStash::Config::AST::Number).first.compile)
158
+
159
+ expect(compiled_number).to be == 8
160
+ end
146
161
  end
147
162
 
148
163
  context "when config.support_escapes" do
@@ -57,14 +57,14 @@ describe LogStash::Environment do
57
57
  context "windows" do
58
58
  windows_host_os.each do |host|
59
59
  it "#{host} returns true" do
60
- expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
60
+ allow(LogStash::Environment).to receive(:host_os).and_return(host)
61
61
  expect(LogStash::Environment.windows?).to be_truthy
62
62
  end
63
63
  end
64
64
 
65
65
  linux_host_os.each do |host|
66
66
  it "#{host} returns false" do
67
- expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
67
+ allow(LogStash::Environment).to receive(:host_os).and_return(host)
68
68
  expect(LogStash::Environment.windows?).to be_falsey
69
69
  end
70
70
  end
@@ -73,14 +73,14 @@ describe LogStash::Environment do
73
73
  context "Linux" do
74
74
  windows_host_os.each do |host|
75
75
  it "#{host} returns true" do
76
- expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
76
+ allow(LogStash::Environment).to receive(:host_os).and_return(host)
77
77
  expect(LogStash::Environment.linux?).to be_falsey
78
78
  end
79
79
  end
80
80
 
81
81
  linux_host_os.each do |host|
82
82
  it "#{host} returns false" do
83
- expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return(host)
83
+ allow(LogStash::Environment).to receive(:host_os).and_return(host)
84
84
  expect(LogStash::Environment.linux?).to be_truthy
85
85
  end
86
86
  end
@@ -267,6 +267,81 @@ describe LogStash::Plugin do
267
267
  end
268
268
  end
269
269
 
270
+ describe "#plugin_metadata" do
271
+ plugin_types = [
272
+ LogStash::Filters::Base,
273
+ LogStash::Codecs::Base,
274
+ LogStash::Outputs::Base,
275
+ LogStash::Inputs::Base
276
+ ]
277
+
278
+ before(:each) { LogStash::PluginMetadata::reset! }
279
+
280
+ plugin_types.each do |plugin_type|
281
+ let(:plugin) do
282
+ Class.new(plugin_type) do
283
+ config_name "simple_plugin"
284
+
285
+ config :host, :validate => :string
286
+ config :export, :validate => :boolean
287
+
288
+ def register; end
289
+ end
290
+ end
291
+
292
+ let(:config) do
293
+ {
294
+ "host" => "127.0.0.1",
295
+ "export" => true
296
+ }
297
+ end
298
+
299
+ subject(:plugin_instance) { plugin.new(config) }
300
+
301
+ context "plugin type is #{plugin_type}" do
302
+ {
303
+ 'when there is not ID configured for the plugin' => {},
304
+ 'when a user provide an ID for the plugin' => { 'id' => 'ABC' },
305
+ }.each do |desc, config_override|
306
+
307
+
308
+ context(desc) do
309
+ let(:config) { super.merge(config_override) }
310
+
311
+ it "has a PluginMetadata" do
312
+ expect(plugin_instance.plugin_metadata).to be_a_kind_of(LogStash::PluginMetadata)
313
+ end
314
+
315
+ it "PluginMetadata is defined" do
316
+ expect(defined?(plugin_instance.plugin_metadata)).to be_truthy
317
+ end
318
+
319
+ if config_override.include?('id')
320
+ it "will be shared between instance of plugins" do
321
+ expect(plugin_instance.plugin_metadata).to equal(plugin.new(config).plugin_metadata)
322
+ end
323
+ end
324
+
325
+ it 'stores metadata' do
326
+ new_value = 'foo'
327
+ old_value = plugin_instance.plugin_metadata.set(:foo, new_value)
328
+ expect(old_value).to be_nil
329
+ expect(plugin_instance.plugin_metadata.get(:foo)).to eq(new_value)
330
+ end
331
+
332
+ it 'removes metadata when the plugin is closed' do
333
+ new_value = 'foo'
334
+ plugin_instance.plugin_metadata.set(:foo, new_value)
335
+ expect(plugin_instance.plugin_metadata.get(:foo)).to eq(new_value)
336
+ plugin_instance.do_close
337
+ expect(plugin_instance.plugin_metadata.set?(:foo)).to be_falsey
338
+ end
339
+ end
340
+ end
341
+ end
342
+ end
343
+ end
344
+
270
345
  describe "#id" do
271
346
  let(:plugin) do
272
347
  Class.new(LogStash::Filters::Base,) do
@@ -0,0 +1,151 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'logstash/plugin_metadata'
5
+ require 'securerandom'
6
+
7
+ describe LogStash::PluginMetadata do
8
+
9
+ let(:registry) { described_class }
10
+ before(:each) { registry.reset! }
11
+
12
+ let(:plugin_id) { SecureRandom.uuid }
13
+
14
+ describe 'registry' do
15
+ describe '#for_plugin' do
16
+ it 'returns the same instance when given the same id' do
17
+ expect(registry.for_plugin(plugin_id)).to be(registry.for_plugin(plugin_id))
18
+ end
19
+ it 'returns different instances when given different ids' do
20
+ expect(registry.for_plugin(plugin_id)).to_not equal(registry.for_plugin(plugin_id.next))
21
+ end
22
+ end
23
+ describe '#exists?' do
24
+ context 'when the plugin has not yet been registered' do
25
+ it 'returns false' do
26
+ expect(registry.exists?(plugin_id)).to be false
27
+ end
28
+ end
29
+ context 'when the plugin has already been registered' do
30
+ before(:each) { registry.for_plugin(plugin_id).set(:foo, 'bar') }
31
+ it 'returns true' do
32
+ expect(registry.exists?(plugin_id)).to be true
33
+ end
34
+ end
35
+ end
36
+ describe '#delete_for_plugin' do
37
+ before(:each) { registry.for_plugin(plugin_id).set(:foo, 'bar') }
38
+ it 'deletes the registry' do
39
+ expect(registry.exists?(plugin_id)).to be true
40
+ registry.delete_for_plugin(plugin_id)
41
+ expect(registry.exists?(plugin_id)).to be false
42
+ end
43
+ it 'deletes the data inside the registry' do
44
+ plugin_registry = registry.for_plugin(plugin_id)
45
+ registry.delete_for_plugin(plugin_id)
46
+ expect(plugin_registry.set?(:foo)).to be false
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ describe 'instance' do
53
+ let(:instance) { registry.for_plugin(plugin_id) }
54
+
55
+ describe '#set' do
56
+ context 'when the key is not set' do
57
+ it 'sets the new value' do
58
+ instance.set(:foo, 'bar')
59
+ expect(instance.get(:foo)).to eq('bar')
60
+ end
61
+ it 'returns the nil' do
62
+ expect(instance.set(:foo, 'bar')).to be_nil
63
+ end
64
+ end
65
+ context 'when the key is set' do
66
+ let (:val) { 'bananas'}
67
+ before(:each) { instance.set(:foo, val) }
68
+
69
+ it 'sets the new value' do
70
+ instance.set(:foo, 'bar')
71
+ expect(instance.get(:foo)).to eq('bar')
72
+ end
73
+ it 'returns the previous associated value' do
74
+ expect(instance.set(:foo, 'bar')).to eq(val)
75
+ end
76
+ context 'when the new value is nil' do
77
+ it 'unsets the value' do
78
+ instance.set(:foo, nil)
79
+ expect(instance.set?(:foo)).to be false
80
+ end
81
+ end
82
+ end
83
+ end
84
+
85
+ describe '#get' do
86
+ context 'when the key is set' do
87
+ before(:each) { instance.set(:foo, 'bananas') }
88
+ it 'returns the associated value' do
89
+ expect(instance.get(:foo)).to eq('bananas')
90
+ end
91
+ end
92
+ context 'when the key is not set' do
93
+ it 'returns nil' do
94
+ expect(instance.get(:foo)).to be_nil
95
+ end
96
+ end
97
+ end
98
+
99
+ describe '#set?' do
100
+ context 'when the key is set' do
101
+ before(:each) { instance.set(:foo, 'bananas')}
102
+ it 'returns true' do
103
+ expect(instance.set?(:foo)).to be true
104
+ end
105
+ end
106
+ context 'when the key is not set' do
107
+ it 'returns false' do
108
+ expect(instance.set?(:foo)).to be false
109
+ end
110
+ end
111
+ end
112
+
113
+ describe '#delete' do
114
+ context 'when the key is set' do
115
+ let (:val) { 'bananas' }
116
+ before(:each) { instance.set(:foo, val)}
117
+ it 'returns the value' do
118
+ expect(instance.delete(:foo)).to be val
119
+ end
120
+ it 'removes the key' do
121
+ instance.delete(:foo)
122
+ expect(instance.set?(:foo)).to be false
123
+ end
124
+ end
125
+ context 'when the key is not set' do
126
+ it 'returns nil' do
127
+ expect(instance.delete(:foo)).to be nil
128
+ end
129
+
130
+ it 'should not be set' do
131
+ instance.delete(:foo)
132
+ expect(instance.set?(:foo)).to be false
133
+ end
134
+ end
135
+ end
136
+
137
+ describe '#clear' do
138
+ context 'when the key is set' do
139
+ before(:each) do
140
+ instance.set(:foo, 'bananas')
141
+ instance.set(:bar, 'more bananas')
142
+ end
143
+ it 'removes all keys' do
144
+ instance.clear
145
+ expect(instance.set?(:foo)).to be false
146
+ expect(instance.set?(:bar)).to be false
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  # alpha and beta qualifiers are now added via VERSION_QUALIFIER environment var
3
- logstash: 7.1.1
4
- logstash-core: 7.1.1
3
+ logstash: 7.2.0
4
+ logstash-core: 7.2.0
5
5
  logstash-core-plugin-api: 2.1.16
6
6
 
7
7
  # jruby must reference a *released* version of jruby which can be downloaded from the official download url
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1
4
+ version: 7.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -162,20 +162,6 @@ dependencies:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0.10'
165
- - !ruby/object:Gem::Dependency
166
- requirement: !ruby/object:Gem::Requirement
167
- requirements:
168
- - - "~>"
169
- - !ruby/object:Gem::Version
170
- version: 0.9.0
171
- name: faraday
172
- type: :runtime
173
- prerelease: false
174
- version_requirements: !ruby/object:Gem::Requirement
175
- requirements:
176
- - - "~>"
177
- - !ruby/object:Gem::Version
178
- version: 0.9.0
179
165
  - !ruby/object:Gem::Dependency
180
166
  requirement: !ruby/object:Gem::Requirement
181
167
  requirements:
@@ -302,6 +288,20 @@ dependencies:
302
288
  - - "~>"
303
289
  - !ruby/object:Gem::Version
304
290
  version: '0.6'
291
+ - !ruby/object:Gem::Dependency
292
+ requirement: !ruby/object:Gem::Requirement
293
+ requirements:
294
+ - - "~>"
295
+ - !ruby/object:Gem::Version
296
+ version: 0.9.0
297
+ name: faraday
298
+ type: :runtime
299
+ prerelease: false
300
+ version_requirements: !ruby/object:Gem::Requirement
301
+ requirements:
302
+ - - "~>"
303
+ - !ruby/object:Gem::Version
304
+ version: 0.9.0
305
305
  description: The core components of logstash, the scalable log and event management
306
306
  tool
307
307
  email:
@@ -337,6 +337,7 @@ files:
337
337
  - lib/logstash/bootstrap_check/persisted_queue_config.rb
338
338
  - lib/logstash/build.rb
339
339
  - lib/logstash/codecs/base.rb
340
+ - lib/logstash/codecs/delegator.rb
340
341
  - lib/logstash/compiler.rb
341
342
  - lib/logstash/compiler/lscl.rb
342
343
  - lib/logstash/compiler/lscl/helpers.rb
@@ -347,6 +348,7 @@ files:
347
348
  - lib/logstash/config/defaults.rb
348
349
  - lib/logstash/config/file.rb
349
350
  - lib/logstash/config/grammar.rb
351
+ - lib/logstash/config/lir_serializer.rb
350
352
  - lib/logstash/config/mixin.rb
351
353
  - lib/logstash/config/modules_common.rb
352
354
  - lib/logstash/config/pipeline_config.rb
@@ -428,6 +430,7 @@ files:
428
430
  - lib/logstash/pipeline_settings.rb
429
431
  - lib/logstash/pipelines_registry.rb
430
432
  - lib/logstash/plugin.rb
433
+ - lib/logstash/plugin_metadata.rb
431
434
  - lib/logstash/plugins.rb
432
435
  - lib/logstash/plugins/builtin.rb
433
436
  - lib/logstash/plugins/builtin/pipeline/input.rb
@@ -486,6 +489,7 @@ files:
486
489
  - spec/logstash/api/rack_app_spec.rb
487
490
  - spec/logstash/bootstrap_check/persisted_queue_config_spec.rb
488
491
  - spec/logstash/codecs/base_spec.rb
492
+ - spec/logstash/codecs/delegator_spec.rb
489
493
  - spec/logstash/compiler/compiler_spec.rb
490
494
  - spec/logstash/config/config_ast_spec.rb
491
495
  - spec/logstash/config/cpu_core_strategy_spec.rb
@@ -579,6 +583,7 @@ files:
579
583
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
580
584
  - spec/logstash/util_spec.rb
581
585
  - spec/logstash/webserver_spec.rb
586
+ - spec/plugin_metadata_spec.rb
582
587
  - spec/static/i18n_spec.rb
583
588
  - spec/support/helpers.rb
584
589
  - spec/support/matchers.rb
@@ -628,6 +633,7 @@ test_files:
628
633
  - spec/logstash/api/rack_app_spec.rb
629
634
  - spec/logstash/bootstrap_check/persisted_queue_config_spec.rb
630
635
  - spec/logstash/codecs/base_spec.rb
636
+ - spec/logstash/codecs/delegator_spec.rb
631
637
  - spec/logstash/compiler/compiler_spec.rb
632
638
  - spec/logstash/config/config_ast_spec.rb
633
639
  - spec/logstash/config/cpu_core_strategy_spec.rb
@@ -721,6 +727,7 @@ test_files:
721
727
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
722
728
  - spec/logstash/util_spec.rb
723
729
  - spec/logstash/webserver_spec.rb
730
+ - spec/plugin_metadata_spec.rb
724
731
  - spec/static/i18n_spec.rb
725
732
  - spec/support/helpers.rb
726
733
  - spec/support/matchers.rb