logstash-core 5.0.0.alpha5.snapshot1-java → 5.0.0.alpha6.snapshot1-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.

Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash-core/version.rb +1 -1
  3. data/lib/logstash/agent.rb +1 -1
  4. data/lib/logstash/api/commands/default_metadata.rb +1 -1
  5. data/lib/logstash/api/commands/hot_threads_reporter.rb +4 -7
  6. data/lib/logstash/api/commands/node.rb +5 -4
  7. data/lib/logstash/api/commands/stats.rb +8 -3
  8. data/lib/logstash/api/modules/base.rb +5 -0
  9. data/lib/logstash/api/modules/node.rb +1 -2
  10. data/lib/logstash/api/modules/node_stats.rb +1 -2
  11. data/lib/logstash/codecs/base.rb +29 -1
  12. data/lib/logstash/config/mixin.rb +1 -1
  13. data/lib/logstash/environment.rb +5 -5
  14. data/lib/logstash/filter_delegator.rb +4 -5
  15. data/lib/logstash/instrument/periodic_poller/jvm.rb +43 -10
  16. data/lib/logstash/output_delegator.rb +33 -168
  17. data/lib/logstash/output_delegator_strategies/legacy.rb +29 -0
  18. data/lib/logstash/output_delegator_strategies/shared.rb +20 -0
  19. data/lib/logstash/output_delegator_strategies/single.rb +23 -0
  20. data/lib/logstash/output_delegator_strategy_registry.rb +36 -0
  21. data/lib/logstash/outputs/base.rb +39 -26
  22. data/lib/logstash/patches/clamp.rb +6 -0
  23. data/lib/logstash/pipeline.rb +42 -14
  24. data/lib/logstash/pipeline_reporter.rb +2 -8
  25. data/lib/logstash/plugin.rb +6 -10
  26. data/lib/logstash/runner.rb +12 -9
  27. data/lib/logstash/settings.rb +124 -21
  28. data/lib/logstash/util/wrapped_synchronous_queue.rb +17 -1
  29. data/lib/logstash/version.rb +1 -1
  30. data/lib/logstash/webserver.rb +44 -33
  31. data/locales/en.yml +5 -1
  32. data/logstash-core.gemspec +2 -2
  33. data/spec/api/lib/api/node_spec.rb +62 -10
  34. data/spec/api/lib/api/node_stats_spec.rb +16 -3
  35. data/spec/api/lib/api/support/resource_dsl_methods.rb +11 -1
  36. data/spec/api/spec_helper.rb +1 -1
  37. data/spec/conditionals_spec.rb +12 -1
  38. data/spec/logstash/agent_spec.rb +3 -0
  39. data/spec/logstash/codecs/base_spec.rb +74 -0
  40. data/spec/logstash/instrument/periodic_poller/jvm_spec.rb +37 -10
  41. data/spec/logstash/output_delegator_spec.rb +64 -89
  42. data/spec/logstash/outputs/base_spec.rb +91 -15
  43. data/spec/logstash/pipeline_reporter_spec.rb +1 -6
  44. data/spec/logstash/pipeline_spec.rb +20 -22
  45. data/spec/logstash/plugin_spec.rb +3 -3
  46. data/spec/logstash/runner_spec.rb +86 -3
  47. data/spec/logstash/settings/integer_spec.rb +20 -0
  48. data/spec/logstash/settings/numeric_spec.rb +28 -0
  49. data/spec/logstash/settings/port_range_spec.rb +93 -0
  50. data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +6 -0
  51. data/spec/logstash/webserver_spec.rb +95 -0
  52. metadata +20 -6
@@ -49,6 +49,12 @@ describe LogStash::Util::WrappedSynchronousQueue do
49
49
  let(:queue) { DummyQueue.new }
50
50
  let(:write_client) { LogStash::Util::WrappedSynchronousQueue::WriteClient.new(queue)}
51
51
  let(:read_client) { LogStash::Util::WrappedSynchronousQueue::ReadClient.new(queue)}
52
+
53
+ before :each do
54
+ read_client.set_events_metric(LogStash::Instrument::NullMetric.new)
55
+ read_client.set_pipeline_metric(LogStash::Instrument::NullMetric.new)
56
+ end
57
+
52
58
  it "appends batches to the queue" do
53
59
  batch = write_client.get_new_batch
54
60
  5.times {|i| batch.push("value-#{i}")}
@@ -0,0 +1,95 @@
1
+ # encoding: utf-8
2
+ # require "logstash/json"
3
+ require "logstash/webserver"
4
+ require "socket"
5
+ require "spec_helper"
6
+ require "open-uri"
7
+
8
+ def block_ports(range)
9
+ servers = []
10
+
11
+ range.each do |port|
12
+ server = TCPServer.new("localhost", port)
13
+ Thread.new do
14
+ client = server.accept rescue nil
15
+ end
16
+ servers << server
17
+ end
18
+
19
+ sleep(1)
20
+ servers
21
+ end
22
+
23
+ def free_ports(servers)
24
+ servers.each do |t|
25
+ t.close rescue nil # the threads are blocked just kill
26
+ end
27
+ end
28
+
29
+ describe LogStash::WebServer do
30
+ before :all do
31
+ @abort = Thread.abort_on_exception
32
+ Thread.abort_on_exception = true
33
+ end
34
+
35
+ after :all do
36
+ Thread.abort_on_exception = @abort
37
+ end
38
+
39
+ let(:logger) { double("logger") }
40
+ let(:agent) { double("agent") }
41
+ let(:webserver) { double("webserver") }
42
+
43
+ before :each do
44
+ [:info, :warn, :error, :fatal, :debug].each do |level|
45
+ allow(logger).to receive(level)
46
+ end
47
+ [:info?, :warn?, :error?, :fatal?, :debug?].each do |level|
48
+ allow(logger).to receive(level)
49
+ end
50
+
51
+ allow(webserver).to receive(:address).and_return("127.0.0.1")
52
+ allow(agent).to receive(:webserver).and_return(webserver)
53
+ end
54
+
55
+ context "when the port is already in use and a range is provided" do
56
+ subject { LogStash::WebServer.new(logger,
57
+ agent,
58
+ { :http_host => "localhost", :http_ports => port_range
59
+ })}
60
+
61
+ let(:port_range) { 10000..10010 }
62
+ after(:each) { free_ports(@servers) }
63
+
64
+ context "when we have available ports" do
65
+ before(:each) do
66
+ @servers = block_ports(10000..10005)
67
+ end
68
+
69
+ it "successfully find an available port" do
70
+ t = Thread.new do
71
+ subject.run
72
+ end
73
+
74
+ sleep(1)
75
+
76
+ response = open("http://localhost:10006").read
77
+ expect { LogStash::Json.load(response) }.not_to raise_error
78
+ expect(subject.address).to eq("localhost:10006")
79
+
80
+ subject.stop
81
+ t.kill rescue nil
82
+ end
83
+ end
84
+
85
+ context "when all the ports are taken" do
86
+ before(:each) do
87
+ @servers = block_ports(port_range)
88
+ end
89
+
90
+ it "raise an exception" do
91
+ expect { subject.run }.to raise_error(Errno::EADDRINUSE, /Logstash tried to bind to port range/)
92
+ end
93
+ end
94
+ end
95
+ end
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.alpha5.snapshot1
4
+ version: 5.0.0.alpha6.snapshot1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 5.0.0.alpha5.snapshot1
18
+ version: 5.0.0.alpha6.snapshot1
19
19
  name: logstash-core-event-java
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.0.alpha5.snapshot1
26
+ version: 5.0.0.alpha6.snapshot1
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -273,7 +273,7 @@ dependencies:
273
273
  requirements:
274
274
  - - "~>"
275
275
  - !ruby/object:Gem::Version
276
- version: 0.3.7
276
+ version: 0.4.0
277
277
  name: jrjackson
278
278
  prerelease: false
279
279
  type: :runtime
@@ -281,7 +281,7 @@ dependencies:
281
281
  requirements:
282
282
  - - "~>"
283
283
  - !ruby/object:Gem::Version
284
- version: 0.3.7
284
+ version: 0.4.0
285
285
  description: The core components of logstash, the scalable log and event management tool
286
286
  email:
287
287
  - info@elastic.co
@@ -349,6 +349,10 @@ files:
349
349
  - lib/logstash/logging/json.rb
350
350
  - lib/logstash/namespace.rb
351
351
  - lib/logstash/output_delegator.rb
352
+ - lib/logstash/output_delegator_strategies/legacy.rb
353
+ - lib/logstash/output_delegator_strategies/shared.rb
354
+ - lib/logstash/output_delegator_strategies/single.rb
355
+ - lib/logstash/output_delegator_strategy_registry.rb
352
356
  - lib/logstash/outputs/base.rb
353
357
  - lib/logstash/patches.rb
354
358
  - lib/logstash/patches/bugfix_jruby_2558.rb
@@ -398,6 +402,7 @@ files:
398
402
  - spec/api/spec_helper.rb
399
403
  - spec/conditionals_spec.rb
400
404
  - spec/logstash/agent_spec.rb
405
+ - spec/logstash/codecs/base_spec.rb
401
406
  - spec/logstash/config/config_ast_spec.rb
402
407
  - spec/logstash/config/cpu_core_strategy_spec.rb
403
408
  - spec/logstash/config/defaults_spec.rb
@@ -427,6 +432,9 @@ files:
427
432
  - spec/logstash/plugins/registry_spec.rb
428
433
  - spec/logstash/runner_spec.rb
429
434
  - spec/logstash/setting_spec.rb
435
+ - spec/logstash/settings/integer_spec.rb
436
+ - spec/logstash/settings/numeric_spec.rb
437
+ - spec/logstash/settings/port_range_spec.rb
430
438
  - spec/logstash/settings/string_spec.rb
431
439
  - spec/logstash/settings_spec.rb
432
440
  - spec/logstash/shutdown_watcher_spec.rb
@@ -438,6 +446,7 @@ files:
438
446
  - spec/logstash/util/unicode_trimmer_spec.rb
439
447
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
440
448
  - spec/logstash/util_spec.rb
449
+ - spec/logstash/webserver_spec.rb
441
450
  - spec/static/i18n_spec.rb
442
451
  - spec/support/matchers.rb
443
452
  - spec/support/mocks_classes.rb
@@ -478,6 +487,7 @@ test_files:
478
487
  - spec/api/spec_helper.rb
479
488
  - spec/conditionals_spec.rb
480
489
  - spec/logstash/agent_spec.rb
490
+ - spec/logstash/codecs/base_spec.rb
481
491
  - spec/logstash/config/config_ast_spec.rb
482
492
  - spec/logstash/config/cpu_core_strategy_spec.rb
483
493
  - spec/logstash/config/defaults_spec.rb
@@ -507,6 +517,9 @@ test_files:
507
517
  - spec/logstash/plugins/registry_spec.rb
508
518
  - spec/logstash/runner_spec.rb
509
519
  - spec/logstash/setting_spec.rb
520
+ - spec/logstash/settings/integer_spec.rb
521
+ - spec/logstash/settings/numeric_spec.rb
522
+ - spec/logstash/settings/port_range_spec.rb
510
523
  - spec/logstash/settings/string_spec.rb
511
524
  - spec/logstash/settings_spec.rb
512
525
  - spec/logstash/shutdown_watcher_spec.rb
@@ -518,6 +531,7 @@ test_files:
518
531
  - spec/logstash/util/unicode_trimmer_spec.rb
519
532
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
520
533
  - spec/logstash/util_spec.rb
534
+ - spec/logstash/webserver_spec.rb
521
535
  - spec/static/i18n_spec.rb
522
536
  - spec/support/matchers.rb
523
537
  - spec/support/mocks_classes.rb