logstash-core 6.3.2-java → 6.4.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.
- checksums.yaml +4 -4
- data/lib/logstash/agent.rb +10 -6
- data/lib/logstash/api/modules/logging.rb +4 -0
- data/lib/logstash/api/service.rb +0 -1
- data/lib/logstash/bootstrap_check/default_config.rb +0 -2
- data/lib/logstash/bootstrap_check/persisted_queue_config.rb +0 -1
- data/lib/logstash/codecs/base.rb +2 -4
- data/lib/logstash/compiler.rb +2 -3
- data/lib/logstash/compiler/lscl.rb +0 -1
- data/lib/logstash/config/config_ast.rb +0 -1
- data/lib/logstash/config/cpu_core_strategy.rb +0 -1
- data/lib/logstash/config/defaults.rb +0 -1
- data/lib/logstash/config/file.rb +0 -2
- data/lib/logstash/config/mixin.rb +4 -7
- data/lib/logstash/config/modules_common.rb +0 -2
- data/lib/logstash/config/source/local.rb +1 -3
- data/lib/logstash/config/source/modules.rb +0 -2
- data/lib/logstash/config/source/multi_local.rb +0 -1
- data/lib/logstash/config/source_loader.rb +1 -2
- data/lib/logstash/dependency_report.rb +19 -6
- data/lib/logstash/elasticsearch_client.rb +0 -2
- data/lib/logstash/environment.rb +3 -2
- data/lib/logstash/errors.rb +1 -15
- data/lib/logstash/event.rb +0 -1
- data/lib/logstash/event_dispatcher.rb +1 -40
- data/lib/logstash/execution_context.rb +2 -19
- data/lib/logstash/filters/base.rb +0 -2
- data/lib/logstash/inputs/base.rb +2 -4
- data/lib/logstash/inputs/threadable.rb +2 -3
- data/lib/logstash/instrument/collector.rb +0 -2
- data/lib/logstash/instrument/metric.rb +1 -105
- data/lib/logstash/instrument/namespaced_metric.rb +1 -58
- data/lib/logstash/instrument/namespaced_null_metric.rb +1 -58
- data/lib/logstash/instrument/null_metric.rb +2 -71
- data/lib/logstash/instrument/periodic_poller/base.rb +0 -1
- data/lib/logstash/instrument/periodic_poller/cgroup.rb +0 -1
- data/lib/logstash/java_pipeline.rb +33 -222
- data/lib/logstash/json.rb +0 -1
- data/lib/logstash/logging.rb +0 -2
- data/lib/logstash/logging/logger.rb +1 -159
- data/lib/logstash/modules/cli_parser.rb +0 -4
- data/lib/logstash/modules/elasticsearch_config.rb +0 -3
- data/lib/logstash/modules/elasticsearch_importer.rb +0 -3
- data/lib/logstash/modules/elasticsearch_resource.rb +0 -1
- data/lib/logstash/modules/file_reader.rb +0 -2
- data/lib/logstash/modules/kibana_base.rb +0 -1
- data/lib/logstash/modules/kibana_client.rb +0 -2
- data/lib/logstash/modules/kibana_config.rb +0 -3
- data/lib/logstash/modules/kibana_dashboards.rb +0 -2
- data/lib/logstash/modules/kibana_importer.rb +0 -3
- data/lib/logstash/modules/kibana_resource.rb +0 -1
- data/lib/logstash/modules/kibana_settings.rb +0 -2
- data/lib/logstash/modules/logstash_config.rb +0 -1
- data/lib/logstash/modules/resource_base.rb +0 -1
- data/lib/logstash/modules/scaffold.rb +0 -3
- data/lib/logstash/modules/settings_merger.rb +0 -2
- data/lib/logstash/namespace.rb +2 -15
- data/lib/logstash/outputs/base.rb +3 -5
- data/lib/logstash/patches/clamp.rb +6 -0
- data/lib/logstash/pipeline.rb +38 -180
- data/lib/logstash/pipeline_action/create.rb +0 -2
- data/lib/logstash/pipeline_action/reload.rb +1 -4
- data/lib/logstash/pipeline_action/stop.rb +0 -2
- data/lib/logstash/pipeline_reporter.rb +2 -108
- data/lib/logstash/plugin.rb +4 -7
- data/lib/logstash/plugins/hooks_registry.rb +1 -63
- data/lib/logstash/plugins/registry.rb +3 -2
- data/lib/logstash/runner.rb +6 -7
- data/lib/logstash/settings.rb +4 -5
- data/lib/logstash/shutdown_watcher.rb +0 -119
- data/lib/logstash/universal_plugin.rb +1 -13
- data/lib/logstash/util.rb +0 -1
- data/lib/logstash/util/buftok.rb +1 -139
- data/lib/logstash/util/byte_value.rb +2 -3
- data/lib/logstash/util/charset.rb +0 -1
- data/lib/logstash/util/cloud_setting_auth.rb +0 -1
- data/lib/logstash/util/cloud_setting_id.rb +20 -8
- data/lib/logstash/util/dead_letter_queue_manager.rb +2 -61
- data/lib/logstash/util/decorators.rb +0 -1
- data/lib/logstash/util/loggable.rb +1 -31
- data/lib/logstash/util/modules_setting_array.rb +2 -2
- data/lib/logstash/util/password.rb +0 -1
- data/lib/logstash/util/plugin_version.rb +0 -1
- data/lib/logstash/util/safe_uri.rb +7 -8
- data/lib/logstash/util/secretstore.rb +1 -38
- data/lib/logstash/util/substitution_variables.rb +4 -5
- data/lib/logstash/util/worker_threads_default_printer.rb +0 -1
- data/locales/en.yml +28 -1
- data/spec/logstash/config/mixin_spec.rb +4 -4
- data/spec/logstash/converge_result_spec.rb +0 -1
- data/spec/logstash/event_dispatcher_spec.rb +0 -2
- data/spec/logstash/event_spec.rb +22 -26
- data/spec/logstash/execution_context_spec.rb +0 -2
- data/spec/logstash/filter_delegator_spec.rb +12 -28
- data/spec/logstash/inputs/base_spec.rb +4 -5
- data/spec/logstash/instrument/metric_spec.rb +0 -1
- data/spec/logstash/instrument/namespaced_metric_spec.rb +0 -2
- data/spec/logstash/instrument/namespaced_null_metric_spec.rb +1 -3
- data/spec/logstash/instrument/null_metric_spec.rb +1 -4
- data/spec/logstash/instrument/periodic_poller/base_spec.rb +0 -1
- data/spec/logstash/instrument/periodic_poller/os_spec.rb +0 -1
- data/spec/logstash/instrument/wrapped_write_client_spec.rb +0 -1
- data/spec/logstash/java_filter_delegator_spec.rb +0 -3
- data/spec/logstash/java_integration_spec.rb +0 -1
- data/spec/logstash/java_pipeline_spec.rb +1 -4
- data/spec/logstash/modules/cli_parser_spec.rb +1 -3
- data/spec/logstash/modules/scaffold_spec.rb +0 -1
- data/spec/logstash/outputs/base_spec.rb +9 -10
- data/spec/logstash/pipeline_action/create_spec.rb +2 -3
- data/spec/logstash/pipeline_action/reload_spec.rb +1 -2
- data/spec/logstash/pipeline_action/stop_spec.rb +0 -1
- data/spec/logstash/pipeline_dlq_commit_spec.rb +0 -6
- data/spec/logstash/pipeline_reporter_spec.rb +18 -4
- data/spec/logstash/pipeline_spec.rb +2 -6
- data/spec/logstash/plugin_spec.rb +1 -2
- data/spec/logstash/plugins/hooks_registry_spec.rb +0 -2
- data/spec/logstash/queue_factory_spec.rb +0 -1
- data/spec/logstash/runner_spec.rb +16 -9
- data/spec/logstash/settings/modules_spec.rb +3 -3
- data/spec/logstash/shutdown_watcher_spec.rb +0 -27
- data/spec/logstash/state_resolver_spec.rb +0 -1
- data/spec/logstash/util/buftok_spec.rb +0 -1
- data/spec/logstash/util/cloud_setting_id_spec.rb +55 -2
- data/spec/logstash/util/secretstore_spec.rb +10 -10
- data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +2 -2
- data/versions-gem-copy.yml +2 -2
- metadata +2 -16
- data/lib/logstash/bootstrap_check/bad_java.rb +0 -16
- data/lib/logstash/bootstrap_check/bad_ruby.rb +0 -12
- data/lib/logstash/converge_result.rb +0 -103
- data/lib/logstash/instrument/global_metrics.rb +0 -13
- data/lib/logstash/instrument/snapshot.rb +0 -15
- data/lib/logstash/java_integration.rb +0 -116
- data/lib/logstash/logging/json.rb +0 -21
- data/lib/logstash/plugins/plugin_factory.rb +0 -107
- data/lib/logstash/queue_factory.rb +0 -34
- data/lib/logstash/util/retryable.rb +0 -40
- data/spec/logstash/output_delegator_spec.rb +0 -201
- data/spec/logstash/timestamp_spec.rb +0 -45
|
@@ -125,10 +125,6 @@ class NilFlushingFilterPeriodic < DummyFlushingFilter
|
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
class JavaTestPipeline < LogStash::JavaPipeline
|
|
129
|
-
attr_reader :outputs, :settings
|
|
130
|
-
end
|
|
131
|
-
|
|
132
128
|
describe LogStash::JavaPipeline do
|
|
133
129
|
let(:worker_thread_count) { 5 }
|
|
134
130
|
let(:safe_thread_count) { 1 }
|
|
@@ -264,6 +260,7 @@ describe LogStash::JavaPipeline do
|
|
|
264
260
|
end
|
|
265
261
|
|
|
266
262
|
it "should print the compiled code if config.debug is set to true" do
|
|
263
|
+
skip("This test does not work when using a Java Logger and should be ported to JUnit")
|
|
267
264
|
pipeline_settings_obj.set("config.debug", true)
|
|
268
265
|
expect(logger).to receive(:debug).with(/Compiled pipeline/, anything)
|
|
269
266
|
pipeline = mock_java_pipeline_from_string(test_config_with_filters, pipeline_settings_obj)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
|
-
require "logstash/logging"
|
|
3
|
-
require "logstash/errors"
|
|
4
2
|
require "logstash/modules/cli_parser"
|
|
5
3
|
|
|
6
4
|
describe LogStash::Modules::CLIParser do
|
|
@@ -126,4 +124,4 @@ describe LogStash::Modules::CLIParser do
|
|
|
126
124
|
end
|
|
127
125
|
end
|
|
128
126
|
|
|
129
|
-
end
|
|
127
|
+
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "spec_helper"
|
|
3
3
|
require "logstash/outputs/base"
|
|
4
|
-
require "logstash/execution_context"
|
|
5
4
|
require "support/shared_contexts"
|
|
6
5
|
|
|
7
6
|
# use a dummy NOOP output to test Outputs::Base
|
|
@@ -20,7 +19,7 @@ end
|
|
|
20
19
|
|
|
21
20
|
class LogStash::Outputs::NOOPShared < ::LogStash::Outputs::Base
|
|
22
21
|
concurrency :shared
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
def register; end
|
|
25
24
|
end
|
|
26
25
|
|
|
@@ -30,7 +29,7 @@ end
|
|
|
30
29
|
|
|
31
30
|
class LogStash::Outputs::NOOPMultiReceiveEncoded < ::LogStash::Outputs::Base
|
|
32
31
|
concurrency :single
|
|
33
|
-
|
|
32
|
+
|
|
34
33
|
def register; end
|
|
35
34
|
|
|
36
35
|
def multi_receive_encoded(events_and_encoded)
|
|
@@ -38,12 +37,12 @@ class LogStash::Outputs::NOOPMultiReceiveEncoded < ::LogStash::Outputs::Base
|
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
describe "LogStash::Outputs::Base#new" do
|
|
41
|
-
let(:params) { {} }
|
|
40
|
+
let(:params) { {} }
|
|
42
41
|
subject(:instance) { klass.new(params.dup) }
|
|
43
42
|
|
|
44
43
|
context "single" do
|
|
45
44
|
let(:klass) { LogStash::Outputs::NOOPSingle }
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
it "should instantiate cleanly" do
|
|
48
47
|
params = { "dummy_option" => "potatoes", "codec" => "json", "workers" => 2 }
|
|
49
48
|
worker_params = params.dup; worker_params["workers"] = 1
|
|
@@ -58,7 +57,7 @@ describe "LogStash::Outputs::Base#new" do
|
|
|
58
57
|
|
|
59
58
|
context "shared" do
|
|
60
59
|
let(:klass) { LogStash::Outputs::NOOPShared }
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
it "should set concurrency correctly" do
|
|
63
62
|
expect(subject.concurrency).to eq(:shared)
|
|
64
63
|
end
|
|
@@ -66,7 +65,7 @@ describe "LogStash::Outputs::Base#new" do
|
|
|
66
65
|
|
|
67
66
|
context "legacy" do
|
|
68
67
|
let(:klass) { LogStash::Outputs::NOOPLegacy }
|
|
69
|
-
|
|
68
|
+
|
|
70
69
|
it "should set concurrency correctly" do
|
|
71
70
|
expect(subject.concurrency).to eq(:legacy)
|
|
72
71
|
end
|
|
@@ -105,16 +104,16 @@ describe "LogStash::Outputs::Base#new" do
|
|
|
105
104
|
describe "dispatching multi_receive" do
|
|
106
105
|
let(:event) { double("event") }
|
|
107
106
|
let(:events) { [event] }
|
|
108
|
-
|
|
107
|
+
|
|
109
108
|
context "with multi_receive_encoded" do
|
|
110
109
|
let(:klass) { LogStash::Outputs::NOOPMultiReceiveEncoded }
|
|
111
110
|
let(:codec) { double("codec") }
|
|
112
111
|
let(:encoded) { double("encoded") }
|
|
113
|
-
|
|
112
|
+
|
|
114
113
|
before do
|
|
115
114
|
allow(codec).to receive(:multi_encode).with(events).and_return(encoded)
|
|
116
115
|
allow(instance).to receive(:codec).and_return(codec)
|
|
117
|
-
allow(instance).to receive(:multi_receive_encoded)
|
|
116
|
+
allow(instance).to receive(:multi_receive_encoded)
|
|
118
117
|
instance.multi_receive(events)
|
|
119
118
|
end
|
|
120
119
|
|
|
@@ -3,7 +3,6 @@ require "spec_helper"
|
|
|
3
3
|
require_relative "../../support/helpers"
|
|
4
4
|
require_relative "../../support/matchers"
|
|
5
5
|
require "logstash/pipeline_action/create"
|
|
6
|
-
require "logstash/instrument/null_metric"
|
|
7
6
|
require "logstash/inputs/generator"
|
|
8
7
|
|
|
9
8
|
describe LogStash::PipelineAction::Create do
|
|
@@ -19,8 +18,8 @@ describe LogStash::PipelineAction::Create do
|
|
|
19
18
|
subject { described_class.new(pipeline_config, metric) }
|
|
20
19
|
|
|
21
20
|
after do
|
|
22
|
-
pipelines.each do |_, pipeline|
|
|
23
|
-
pipeline.shutdown
|
|
21
|
+
pipelines.each do |_, pipeline|
|
|
22
|
+
pipeline.shutdown
|
|
24
23
|
pipeline.thread.join
|
|
25
24
|
end
|
|
26
25
|
end
|
|
@@ -3,7 +3,6 @@ require "spec_helper"
|
|
|
3
3
|
require_relative "../../support/helpers"
|
|
4
4
|
require_relative "../../support/matchers"
|
|
5
5
|
require "logstash/pipeline_action/reload"
|
|
6
|
-
require "logstash/instrument/null_metric"
|
|
7
6
|
|
|
8
7
|
describe LogStash::PipelineAction::Reload do
|
|
9
8
|
let(:metric) { LogStash::Instrument::NullMetric.new(LogStash::Instrument::Collector.new) }
|
|
@@ -22,7 +21,7 @@ describe LogStash::PipelineAction::Reload do
|
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
after do
|
|
25
|
-
pipelines.each do |_, pipeline|
|
|
24
|
+
pipelines.each do |_, pipeline|
|
|
26
25
|
pipeline.shutdown
|
|
27
26
|
pipeline.thread.join
|
|
28
27
|
end
|
|
@@ -3,7 +3,6 @@ require "spec_helper"
|
|
|
3
3
|
require_relative "../../support/helpers"
|
|
4
4
|
require "logstash/pipeline_action/stop"
|
|
5
5
|
require "logstash/pipeline"
|
|
6
|
-
require "logstash/instrument/null_metric"
|
|
7
6
|
|
|
8
7
|
describe LogStash::PipelineAction::Stop do
|
|
9
8
|
let(:pipeline_config) { "input { generator {} } output { null {} }" }
|
|
@@ -75,9 +75,6 @@ describe LogStash::Pipeline do
|
|
|
75
75
|
let(:pipeline_id) { "test-dlq" }
|
|
76
76
|
|
|
77
77
|
it "retrieves proper pipeline-level DLQ writer" do
|
|
78
|
-
expect(LogStash::Util::PluginDeadLetterQueueWriter).to receive(:new).with(anything, "input_id", "singlegenerator").and_call_original
|
|
79
|
-
expect(LogStash::Util::PluginDeadLetterQueueWriter).to receive(:new).with(anything, "filter_id", "dlq_commit").and_call_original
|
|
80
|
-
expect(LogStash::Util::PluginDeadLetterQueueWriter).to receive(:new).with(anything, "output_id", "dummyoutput").and_call_original
|
|
81
78
|
expect_any_instance_of(org.logstash.common.io.DeadLetterQueueWriter).to receive(:close).and_call_original
|
|
82
79
|
subject.run
|
|
83
80
|
dlq_path = java.nio.file.Paths.get(pipeline_settings_obj.get("path.dead_letter_queue"), pipeline_id)
|
|
@@ -94,9 +91,6 @@ describe LogStash::Pipeline do
|
|
|
94
91
|
let(:pipeline_id) { "test-without-dlq" }
|
|
95
92
|
|
|
96
93
|
it "does not write to the DLQ" do
|
|
97
|
-
expect(LogStash::Util::PluginDeadLetterQueueWriter).to receive(:new).with(anything, "input_id", "singlegenerator").and_call_original
|
|
98
|
-
expect(LogStash::Util::PluginDeadLetterQueueWriter).to receive(:new).with(anything, "filter_id", "dlq_commit").and_call_original
|
|
99
|
-
expect(LogStash::Util::PluginDeadLetterQueueWriter).to receive(:new).with(anything, "output_id", "dummyoutput").and_call_original
|
|
100
94
|
expect(LogStash::Util::DummyDeadLetterQueueWriter).to receive(:new).and_call_original
|
|
101
95
|
expect_any_instance_of(LogStash::Util::DummyDeadLetterQueueWriter).to receive(:close).and_call_original
|
|
102
96
|
subject.run
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "spec_helper"
|
|
3
3
|
require "logstash/pipeline"
|
|
4
|
-
require "logstash/pipeline_reporter"
|
|
5
4
|
require_relative "../support/helpers"
|
|
6
5
|
require_relative "../support/mocks_classes"
|
|
7
6
|
|
|
8
7
|
#TODO: Figure out how to add more tests that actually cover inflight events
|
|
9
8
|
#This will require some janky multithreading stuff
|
|
10
|
-
|
|
9
|
+
shared_examples "a pipeline reporter" do |pipeline_setup|
|
|
11
10
|
let(:generator_count) { 5 }
|
|
12
11
|
let(:config) do
|
|
13
12
|
"input { generator { count => #{generator_count} } } output { dummyoutput {} } "
|
|
14
13
|
end
|
|
15
|
-
let(:pipeline) {
|
|
14
|
+
let(:pipeline) { Kernel.send(pipeline_setup, config)}
|
|
16
15
|
let(:reporter) { pipeline.reporter }
|
|
17
16
|
|
|
18
17
|
before do
|
|
@@ -21,7 +20,7 @@ describe LogStash::PipelineReporter do
|
|
|
21
20
|
allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_call_original
|
|
22
21
|
|
|
23
22
|
@pre_snapshot = reporter.snapshot
|
|
24
|
-
|
|
23
|
+
|
|
25
24
|
pipeline.run
|
|
26
25
|
@post_snapshot = reporter.snapshot
|
|
27
26
|
end
|
|
@@ -30,6 +29,16 @@ describe LogStash::PipelineReporter do
|
|
|
30
29
|
pipeline.shutdown
|
|
31
30
|
end
|
|
32
31
|
|
|
32
|
+
describe "stalling threads info" do
|
|
33
|
+
it "should start with no stalled threads" do
|
|
34
|
+
expect(@pre_snapshot.stalling_threads_info).to eql([])
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should end with no stalled threads" do
|
|
38
|
+
expect(@pre_snapshot.stalling_threads_info).to eql([])
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
33
42
|
describe "events filtered" do
|
|
34
43
|
it "should start at zero" do
|
|
35
44
|
expect(@pre_snapshot.events_filtered).to eql(0)
|
|
@@ -60,3 +69,8 @@ describe LogStash::PipelineReporter do
|
|
|
60
69
|
end
|
|
61
70
|
end
|
|
62
71
|
end
|
|
72
|
+
|
|
73
|
+
describe LogStash::PipelineReporter do
|
|
74
|
+
it_behaves_like "a pipeline reporter", :mock_pipeline_from_string
|
|
75
|
+
it_behaves_like "a pipeline reporter", :mock_java_pipeline_from_string
|
|
76
|
+
end
|
|
@@ -118,10 +118,6 @@ class DummyFlushingFilterPeriodic < DummyFlushingFilter
|
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
-
class TestPipeline < LogStash::Pipeline
|
|
122
|
-
attr_reader :outputs, :settings
|
|
123
|
-
end
|
|
124
|
-
|
|
125
121
|
describe LogStash::Pipeline do
|
|
126
122
|
let(:worker_thread_count) { 5 }
|
|
127
123
|
let(:safe_thread_count) { 1 }
|
|
@@ -370,7 +366,7 @@ describe LogStash::Pipeline do
|
|
|
370
366
|
after do
|
|
371
367
|
pipeline.shutdown
|
|
372
368
|
end
|
|
373
|
-
|
|
369
|
+
|
|
374
370
|
it "should call close of output without output-workers" do
|
|
375
371
|
pipeline.run
|
|
376
372
|
|
|
@@ -395,7 +391,7 @@ describe LogStash::Pipeline do
|
|
|
395
391
|
# cause the suite to fail :(
|
|
396
392
|
pipeline.close
|
|
397
393
|
end
|
|
398
|
-
|
|
394
|
+
|
|
399
395
|
it "should use LIR provided IDs" do
|
|
400
396
|
expect(pipeline.inputs.first.id).to eq(pipeline.lir.input_plugin_vertices.first.id)
|
|
401
397
|
expect(pipeline.filters.first.id).to eq(pipeline.lir.filter_plugin_vertices.first.id)
|
|
@@ -5,7 +5,6 @@ require "logstash/outputs/base"
|
|
|
5
5
|
require "logstash/codecs/base"
|
|
6
6
|
require "logstash/inputs/base"
|
|
7
7
|
require "logstash/filters/base"
|
|
8
|
-
require "logstash/execution_context"
|
|
9
8
|
require "support/shared_contexts"
|
|
10
9
|
|
|
11
10
|
describe LogStash::Plugin do
|
|
@@ -319,7 +318,7 @@ describe LogStash::Plugin do
|
|
|
319
318
|
end
|
|
320
319
|
end
|
|
321
320
|
|
|
322
|
-
subject { plugin.new(config) }
|
|
321
|
+
subject { plugin.new(config) }
|
|
323
322
|
|
|
324
323
|
context "when no metric is set to the plugin" do
|
|
325
324
|
context "when `enable_metric` is TRUE" do
|
|
@@ -5,7 +5,6 @@ require "stud/task"
|
|
|
5
5
|
require "stud/trap"
|
|
6
6
|
require "stud/temporary"
|
|
7
7
|
require "logstash/util/java_version"
|
|
8
|
-
require "logstash/logging/json"
|
|
9
8
|
require "logstash/config/source_loader"
|
|
10
9
|
require "logstash/config/modules_common"
|
|
11
10
|
require "logstash/modules/util"
|
|
@@ -43,6 +42,10 @@ describe LogStash::Runner do
|
|
|
43
42
|
allow(agent).to receive(:shutdown)
|
|
44
43
|
end
|
|
45
44
|
|
|
45
|
+
after(:each) do
|
|
46
|
+
LogStash::SETTINGS.get_value("modules_list").clear
|
|
47
|
+
end
|
|
48
|
+
|
|
46
49
|
describe "argument precedence" do
|
|
47
50
|
let(:config) { "input {} output {}" }
|
|
48
51
|
let(:cli_args) { ["-e", config, "-w", "20"] }
|
|
@@ -83,23 +86,27 @@ describe LogStash::Runner do
|
|
|
83
86
|
|
|
84
87
|
context "--pluginpath" do
|
|
85
88
|
subject { LogStash::Runner.new("") }
|
|
86
|
-
let(:
|
|
87
|
-
let(:
|
|
89
|
+
let(:valid_directory) { Stud::Temporary.directory }
|
|
90
|
+
let(:invalid_directory) { "/a/path/that/doesnt/exist" }
|
|
91
|
+
let(:multiple_paths) { [Stud::Temporary.directory, Stud::Temporary.directory] }
|
|
92
|
+
|
|
93
|
+
it "should pass -p contents to the configure_plugin_paths method" do
|
|
94
|
+
args = ["-p", valid_directory]
|
|
95
|
+
expect(subject).to receive(:configure_plugin_paths).with([valid_directory])
|
|
96
|
+
expect { subject.run(args) }.to_not raise_error
|
|
97
|
+
end
|
|
88
98
|
|
|
89
99
|
it "should add single valid dir path to the environment" do
|
|
90
|
-
expect(
|
|
91
|
-
|
|
92
|
-
subject.configure_plugin_paths(single_path)
|
|
100
|
+
expect(LogStash::Environment).to receive(:add_plugin_path).with(valid_directory)
|
|
101
|
+
subject.configure_plugin_paths(valid_directory)
|
|
93
102
|
end
|
|
94
103
|
|
|
95
104
|
it "should fail with single invalid dir path" do
|
|
96
|
-
expect(File).to receive(:directory?).and_return(false)
|
|
97
105
|
expect(LogStash::Environment).not_to receive(:add_plugin_path)
|
|
98
|
-
expect{subject.configure_plugin_paths(
|
|
106
|
+
expect{subject.configure_plugin_paths(invalid_directory)}.to raise_error(Clamp::UsageError)
|
|
99
107
|
end
|
|
100
108
|
|
|
101
109
|
it "should add multiple valid dir path to the environment" do
|
|
102
|
-
expect(File).to receive(:directory?).exactly(multiple_paths.size).times.and_return(true)
|
|
103
110
|
multiple_paths.each{|path| expect(LogStash::Environment).to receive(:add_plugin_path).with(path)}
|
|
104
111
|
subject.configure_plugin_paths(multiple_paths)
|
|
105
112
|
end
|
|
@@ -34,19 +34,19 @@ describe LogStash::Setting::Modules do
|
|
|
34
34
|
subject { described_class.new("mycloudid", LogStash::Util::CloudSettingId) }
|
|
35
35
|
context "when given a string which is not a cloud id" do
|
|
36
36
|
it "should raise an exception" do
|
|
37
|
-
expect { subject.set("foobarbaz") }.to raise_error(ArgumentError, /Cloud Id
|
|
37
|
+
expect { subject.set("foobarbaz") }.to raise_error(ArgumentError, /Cloud Id.*is invalid/)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
context "when given a string which is empty" do
|
|
42
42
|
it "should raise an exception" do
|
|
43
|
-
expect { subject.set("") }.to raise_error(ArgumentError, /Cloud Id
|
|
43
|
+
expect { subject.set("") }.to raise_error(ArgumentError, /Cloud Id.*is invalid/)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
context "when given a string which is has environment prefix only" do
|
|
48
48
|
it "should raise an exception" do
|
|
49
|
-
expect { subject.set("testing:") }.to raise_error(ArgumentError, /Cloud Id
|
|
49
|
+
expect { subject.set("testing:") }.to raise_error(ArgumentError, /Cloud Id.*is invalid/)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "spec_helper"
|
|
3
|
-
require "logstash/shutdown_watcher"
|
|
4
3
|
|
|
5
4
|
describe LogStash::ShutdownWatcher do
|
|
6
5
|
let(:check_every) { 0.01 }
|
|
@@ -24,32 +23,6 @@ describe LogStash::ShutdownWatcher do
|
|
|
24
23
|
allow(reporter_snapshot).to receive(:stalling_threads) { { } }
|
|
25
24
|
end
|
|
26
25
|
|
|
27
|
-
describe ".unsafe_shutdown = true" do
|
|
28
|
-
let(:abort_threshold) { subject.abort_threshold }
|
|
29
|
-
let(:report_every) { subject.report_every }
|
|
30
|
-
|
|
31
|
-
before :each do
|
|
32
|
-
subject.class.unsafe_shutdown = true
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "should force the shutdown" do
|
|
36
|
-
expect(subject).to receive(:force_exit).once
|
|
37
|
-
subject.start
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "should do exactly \"abort_threshold\" stall checks" do
|
|
41
|
-
allow(subject).to receive(:force_exit)
|
|
42
|
-
expect(subject).to receive(:shutdown_stalled?).exactly(abort_threshold).times.and_call_original
|
|
43
|
-
subject.start
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "should do exactly \"abort_threshold\"*\"report_every\" stall checks" do
|
|
47
|
-
allow(subject).to receive(:force_exit)
|
|
48
|
-
expect(subject).to receive(:pipeline_report_snapshot).exactly(abort_threshold*report_every).times.and_call_original
|
|
49
|
-
subject.start
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
26
|
describe ".unsafe_shutdown = false" do
|
|
54
27
|
|
|
55
28
|
before :each do
|
|
@@ -4,7 +4,6 @@ require_relative "../support/helpers"
|
|
|
4
4
|
require_relative "../support/matchers"
|
|
5
5
|
require "logstash/state_resolver"
|
|
6
6
|
require "logstash/config/pipeline_config"
|
|
7
|
-
require "logstash/instrument/null_metric"
|
|
8
7
|
require "logstash/pipeline"
|
|
9
8
|
require "ostruct"
|
|
10
9
|
require "digest"
|