logstash-core 2.1.0.snapshot1-java → 2.1.0.snapshot2-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/agent.rb +2 -2
- data/lib/logstash/event.rb +1 -1
- data/lib/logstash/pipeline.rb +28 -8
- data/lib/logstash/util/defaults_printer.rb +1 -1
- data/lib/logstash/util/worker_threads_default_printer.rb +14 -2
- data/lib/logstash/version.rb +1 -1
- data/logstash-core.gemspec +1 -0
- data/spec/core/event_spec.rb +18 -0
- data/spec/core/pipeline_spec.rb +113 -7
- data/spec/plugin_manager/install_spec.rb +28 -0
- data/spec/plugin_manager/update_spec.rb +39 -0
- data/spec/plugin_manager/util_spec.rb +71 -0
- data/spec/util/compress_spec.rb +121 -0
- data/spec/util/defaults_printer_spec.rb +3 -2
- data/spec/util/worker_threads_default_printer_spec.rb +30 -11
- metadata +68 -48
- data/spec/pluginmanager/util_spec.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df26ae829d2eb22f63fa59c3b1ef2c12e6f6cb08
|
4
|
+
data.tar.gz: fb085312c7eb9eab720792dfae8d37940ea3c56a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d70144723adacaf709e415ff9b68f42ad0d0a623d1268e78a04cc1e5bc24be747575297ed6ebeeb94e70c8cc7ae199b6cc18aacd7ceb1ea29ec1e5dd57db6fa1
|
7
|
+
data.tar.gz: 3db5d330c35e1cd0a7b29b29f615ec2753acbee2bfb933f7c40a037d7377bfb05659133567ea320158ae31a6762be3b94e5a9e83bff7624d93fa5a5d00ccb004
|
data/lib/logstash/agent.rb
CHANGED
@@ -23,7 +23,7 @@ class LogStash::Agent < Clamp::Command
|
|
23
23
|
option ["-w", "--filterworkers"], "COUNT",
|
24
24
|
I18n.t("logstash.agent.flag.filterworkers"),
|
25
25
|
:attribute_name => :filter_workers,
|
26
|
-
:default =>
|
26
|
+
:default => 0, &:to_i
|
27
27
|
|
28
28
|
option ["-l", "--log"], "FILE",
|
29
29
|
I18n.t("logstash.agent.flag.log"),
|
@@ -143,7 +143,7 @@ class LogStash::Agent < Clamp::Command
|
|
143
143
|
configure_logging(log_file)
|
144
144
|
end
|
145
145
|
|
146
|
-
pipeline.configure("filter-workers", filter_workers)
|
146
|
+
pipeline.configure("filter-workers", filter_workers) if filter_workers > 0
|
147
147
|
|
148
148
|
# Stop now if we are only asking for a config test.
|
149
149
|
if config_test?
|
data/lib/logstash/event.rb
CHANGED
data/lib/logstash/pipeline.rb
CHANGED
@@ -46,7 +46,7 @@ class LogStash::Pipeline
|
|
46
46
|
@filter_to_output = filters? ? SizedQueue.new(20) : @input_to_filter
|
47
47
|
|
48
48
|
@settings = {
|
49
|
-
"filter-workers" => LogStash::Config::CpuCoreStrategy.fifty_percent
|
49
|
+
"default-filter-workers" => LogStash::Config::CpuCoreStrategy.fifty_percent
|
50
50
|
}
|
51
51
|
|
52
52
|
# @ready requires thread safety since it is typically polled from outside the pipeline thread
|
@@ -59,14 +59,32 @@ class LogStash::Pipeline
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def configure(setting, value)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
@settings[setting] = value
|
63
|
+
end
|
64
|
+
|
65
|
+
def safe_filter_worker_count
|
66
|
+
default = @settings["default-filter-workers"]
|
67
|
+
thread_count = @settings["filter-workers"] #override from args "-w 8" or config
|
68
|
+
safe_filters, unsafe_filters = @filters.partition(&:threadsafe?)
|
69
|
+
if unsafe_filters.any?
|
70
|
+
plugins = unsafe_filters.collect { |f| f.class.config_name }
|
71
|
+
case thread_count
|
72
|
+
when nil
|
73
|
+
# user did not specify a worker thread count
|
74
|
+
# warn if the default is multiple
|
75
|
+
@logger.warn("Defaulting filter worker threads to 1 because there are some filters that might not work with multiple worker threads",
|
76
|
+
:count_was => default, :filters => plugins) if default > 1
|
77
|
+
1 # can't allow the default value to propagate if there are unsafe filters
|
78
|
+
when 0, 1
|
79
|
+
1
|
80
|
+
else
|
81
|
+
@logger.warn("Warning: Manual override - there are filters that might not work with multiple worker threads",
|
82
|
+
:worker_threads => thread_count, :filters => plugins)
|
83
|
+
thread_count # allow user to force this even if there are unsafe filters
|
67
84
|
end
|
85
|
+
else
|
86
|
+
thread_count || default
|
68
87
|
end
|
69
|
-
@settings[setting] = value
|
70
88
|
end
|
71
89
|
|
72
90
|
def filters?
|
@@ -149,7 +167,9 @@ class LogStash::Pipeline
|
|
149
167
|
|
150
168
|
def start_filters
|
151
169
|
@filters.each(&:register)
|
152
|
-
|
170
|
+
# dynamically get thread count based on filter threadsafety
|
171
|
+
# moved this test to here to allow for future config reloading
|
172
|
+
to_start = safe_filter_worker_count
|
153
173
|
@filter_threads = to_start.times.collect do
|
154
174
|
Thread.new { filterworker }
|
155
175
|
end
|
@@ -6,11 +6,23 @@ require "logstash/util"
|
|
6
6
|
module LogStash module Util class WorkerThreadsDefaultPrinter
|
7
7
|
|
8
8
|
def initialize(settings)
|
9
|
-
@setting = settings.fetch('filter-workers',
|
9
|
+
@setting = settings.fetch('filter-workers', 0)
|
10
|
+
@default = settings.fetch('default-filter-workers', 0)
|
10
11
|
end
|
11
12
|
|
12
13
|
def visit(collector)
|
13
|
-
collector
|
14
|
+
visit_setting(collector)
|
15
|
+
visit_default(collector)
|
16
|
+
end
|
17
|
+
|
18
|
+
def visit_setting(collector)
|
19
|
+
return if @setting == 0
|
20
|
+
collector.push("User set filter workers: #{@setting}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def visit_default(collector)
|
24
|
+
return if @default == 0
|
25
|
+
collector.push "Default filter workers: #{@default}"
|
14
26
|
end
|
15
27
|
|
16
28
|
end end end
|
data/lib/logstash/version.rb
CHANGED
data/logstash-core.gemspec
CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |gem|
|
|
35
35
|
|
36
36
|
# filetools and rakelib
|
37
37
|
gem.add_runtime_dependency "minitar", "~> 0.5.4"
|
38
|
+
gem.add_runtime_dependency "rubyzip", "~> 1.1.7"
|
38
39
|
gem.add_runtime_dependency "thread_safe", "~> 0.3.5" #(Apache 2.0 license)
|
39
40
|
|
40
41
|
if RUBY_PLATFORM == 'java'
|
data/spec/core/event_spec.rb
CHANGED
@@ -496,4 +496,22 @@ describe LogStash::Event do
|
|
496
496
|
subject{LogStash::Event.new(LogStash::Json.load(LogStash::Json.dump(event_hash)))}
|
497
497
|
end
|
498
498
|
end
|
499
|
+
|
500
|
+
|
501
|
+
describe "#to_s" do
|
502
|
+
let(:timestamp) { LogStash::Timestamp.new }
|
503
|
+
let(:event1) { LogStash::Event.new({ "@timestamp" => timestamp, "host" => "foo", "message" => "bar"}) }
|
504
|
+
let(:event2) { LogStash::Event.new({ "host" => "bar", "message" => "foo"}) }
|
505
|
+
|
506
|
+
it "should cache only one template" do
|
507
|
+
expect {
|
508
|
+
event1.to_s
|
509
|
+
event2.to_s
|
510
|
+
}.to change { LogStash::StringInterpolation::CACHE.size }.by(1)
|
511
|
+
end
|
512
|
+
|
513
|
+
it "return the string containing the timestamp, the host and the message" do
|
514
|
+
expect(event1.to_s).to eq("#{timestamp.to_iso8601} #{event1["host"]} #{event1["message"]}")
|
515
|
+
end
|
516
|
+
end
|
499
517
|
end
|
data/spec/core/pipeline_spec.rb
CHANGED
@@ -53,20 +53,127 @@ class DummyOutput < LogStash::Outputs::Base
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
class DummyFilter < LogStash::Filters::Base
|
57
|
+
config_name "dummyfilter"
|
58
|
+
milestone 2
|
59
|
+
|
60
|
+
def register() end
|
61
|
+
|
62
|
+
def filter(event) end
|
63
|
+
|
64
|
+
def threadsafe?() false; end
|
65
|
+
|
66
|
+
def close() end
|
67
|
+
end
|
68
|
+
|
69
|
+
class DummySafeFilter < LogStash::Filters::Base
|
70
|
+
config_name "dummysafefilter"
|
71
|
+
milestone 2
|
72
|
+
|
73
|
+
def register() end
|
74
|
+
|
75
|
+
def filter(event) end
|
76
|
+
|
77
|
+
def threadsafe?() true; end
|
78
|
+
|
79
|
+
def close() end
|
80
|
+
end
|
81
|
+
|
56
82
|
class TestPipeline < LogStash::Pipeline
|
57
|
-
attr_reader :outputs
|
83
|
+
attr_reader :outputs, :filter_threads, :settings, :logger
|
58
84
|
end
|
59
85
|
|
60
86
|
describe LogStash::Pipeline do
|
87
|
+
let(:worker_thread_count) { 8 }
|
88
|
+
let(:safe_thread_count) { 1 }
|
89
|
+
let(:override_thread_count) { 42 }
|
90
|
+
|
91
|
+
describe "defaulting the filter workers based on thread safety" do
|
92
|
+
before(:each) do
|
93
|
+
allow(LogStash::Plugin).to receive(:lookup).with("input", "dummyinput").and_return(DummyInput)
|
94
|
+
allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_return(DummyCodec)
|
95
|
+
allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutput").and_return(DummyOutput)
|
96
|
+
allow(LogStash::Plugin).to receive(:lookup).with("filter", "dummyfilter").and_return(DummyFilter)
|
97
|
+
allow(LogStash::Plugin).to receive(:lookup).with("filter", "dummysafefilter").and_return(DummySafeFilter)
|
98
|
+
allow(LogStash::Config::CpuCoreStrategy).to receive(:fifty_percent).and_return(worker_thread_count)
|
99
|
+
end
|
100
|
+
|
101
|
+
context "when there are some not threadsafe filters" do
|
102
|
+
let(:test_config_with_filters) {
|
103
|
+
<<-eos
|
104
|
+
input {
|
105
|
+
dummyinput {}
|
106
|
+
}
|
107
|
+
|
108
|
+
filter {
|
109
|
+
dummyfilter {}
|
110
|
+
}
|
111
|
+
|
112
|
+
output {
|
113
|
+
dummyoutput {}
|
114
|
+
}
|
115
|
+
eos
|
116
|
+
}
|
117
|
+
|
118
|
+
context "when there is no command line -w N set" do
|
119
|
+
it "starts one filter thread" do
|
120
|
+
msg = "Defaulting filter worker threads to 1 because there are some" +
|
121
|
+
" filters that might not work with multiple worker threads"
|
122
|
+
pipeline = TestPipeline.new(test_config_with_filters)
|
123
|
+
expect(pipeline.logger).to receive(:warn).with(msg,
|
124
|
+
{:count_was=>worker_thread_count, :filters=>["dummyfilter"]})
|
125
|
+
pipeline.run
|
126
|
+
expect(pipeline.filter_threads.size).to eq(safe_thread_count)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context "when there is command line -w N set" do
|
131
|
+
it "starts multiple filter thread" do
|
132
|
+
msg = "Warning: Manual override - there are filters that might" +
|
133
|
+
" not work with multiple worker threads"
|
134
|
+
pipeline = TestPipeline.new(test_config_with_filters)
|
135
|
+
expect(pipeline.logger).to receive(:warn).with(msg,
|
136
|
+
{:worker_threads=> override_thread_count, :filters=>["dummyfilter"]})
|
137
|
+
pipeline.configure("filter-workers", override_thread_count)
|
138
|
+
pipeline.run
|
139
|
+
expect(pipeline.filter_threads.size).to eq(override_thread_count)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context "when there are threadsafe filters only" do
|
145
|
+
let(:test_config_with_filters) {
|
146
|
+
<<-eos
|
147
|
+
input {
|
148
|
+
dummyinput {}
|
149
|
+
}
|
150
|
+
|
151
|
+
filter {
|
152
|
+
dummysafefilter {}
|
153
|
+
}
|
61
154
|
|
62
|
-
|
155
|
+
output {
|
156
|
+
dummyoutput {}
|
157
|
+
}
|
158
|
+
eos
|
159
|
+
}
|
63
160
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
161
|
+
it "starts multiple filter threads" do
|
162
|
+
pipeline = TestPipeline.new(test_config_with_filters)
|
163
|
+
pipeline.run
|
164
|
+
expect(pipeline.filter_threads.size).to eq(worker_thread_count)
|
165
|
+
end
|
166
|
+
end
|
68
167
|
end
|
69
168
|
|
169
|
+
context "close" do
|
170
|
+
before(:each) do
|
171
|
+
allow(LogStash::Plugin).to receive(:lookup).with("input", "dummyinput").and_return(DummyInput)
|
172
|
+
allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_return(DummyCodec)
|
173
|
+
allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutput").and_return(DummyOutput)
|
174
|
+
end
|
175
|
+
|
176
|
+
|
70
177
|
let(:test_config_without_output_workers) {
|
71
178
|
<<-eos
|
72
179
|
input {
|
@@ -191,6 +298,5 @@ context "close" do
|
|
191
298
|
expect(subject[2]["foo"]).to eq("bar")
|
192
299
|
end
|
193
300
|
end
|
194
|
-
|
195
301
|
end
|
196
302
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'pluginmanager/main'
|
4
|
+
|
5
|
+
describe LogStash::PluginManager::Install do
|
6
|
+
let(:cmd) { LogStash::PluginManager::Install.new("install") }
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
expect(cmd).to receive(:validate_cli_options!).and_return(nil)
|
10
|
+
end
|
11
|
+
|
12
|
+
context "when validating plugins" do
|
13
|
+
let(:sources) { ["https://rubygems.org", "http://localhost:9292"] }
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
expect(cmd).to receive(:plugins_gems).and_return([["dummy", nil]])
|
17
|
+
expect(cmd).to receive(:install_gems_list!).and_return(nil)
|
18
|
+
expect(cmd).to receive(:remove_unused_locally_installed_gems!).and_return(nil)
|
19
|
+
cmd.verify = true
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should load all the sources defined in the Gemfile" do
|
23
|
+
expect(cmd.gemfile.gemset).to receive(:sources).and_return(sources)
|
24
|
+
expect(LogStash::PluginManager).to receive(:logstash_plugin?).with("dummy", nil, {:rubygems_source => sources}).and_return(true)
|
25
|
+
cmd.execute
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'pluginmanager/main'
|
4
|
+
|
5
|
+
describe LogStash::PluginManager::Update do
|
6
|
+
let(:cmd) { LogStash::PluginManager::Update.new("update") }
|
7
|
+
let(:sources) { cmd.gemfile.gemset.sources }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
expect(cmd).to receive(:find_latest_gem_specs).and_return({})
|
11
|
+
allow(cmd).to receive(:warn_local_gems).and_return(nil)
|
12
|
+
expect(cmd).to receive(:display_updated_plugins).and_return(nil)
|
13
|
+
expect_any_instance_of(LogStash::Bundler).to receive(:invoke!).with(:clean => true)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "pass all gem sources to the bundle update command" do
|
17
|
+
sources = cmd.gemfile.gemset.sources
|
18
|
+
expect_any_instance_of(LogStash::Bundler).to receive(:invoke!).with(:update => [], :rubygems_source => sources)
|
19
|
+
cmd.execute
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when skipping validation" do
|
23
|
+
let(:cmd) { LogStash::PluginManager::Update.new("update") }
|
24
|
+
let(:plugin) { OpenStruct.new(:name => "dummy", :options => {} ) }
|
25
|
+
|
26
|
+
before(:each) do
|
27
|
+
expect(cmd.gemfile).to receive(:find).with(plugin).and_return(plugin)
|
28
|
+
expect(cmd.gemfile).to receive(:save).and_return(nil)
|
29
|
+
expect(cmd).to receive(:plugins_to_update).and_return([plugin])
|
30
|
+
expect_any_instance_of(LogStash::Bundler).to receive(:invoke!).with(:update => [plugin], :rubygems_source => sources).and_return(nil)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "skips version verification when ask for it" do
|
34
|
+
cmd.verify = false
|
35
|
+
expect(cmd).to_not receive(:validates_version)
|
36
|
+
cmd.execute
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'pluginmanager/util'
|
4
|
+
require 'gems'
|
5
|
+
|
6
|
+
describe LogStash::PluginManager do
|
7
|
+
|
8
|
+
describe "fetching plugin information" do
|
9
|
+
let(:plugin_name) { "logstash-output-elasticsearch" }
|
10
|
+
|
11
|
+
let(:version_data) do
|
12
|
+
[ { "authors"=>"Elastic", "built_at"=>"2015-08-11T00:00:00.000Z", "description"=>"Output events to elasticsearch",
|
13
|
+
"downloads_count"=>1638, "metadata"=>{"logstash_group"=>"output", "logstash_plugin"=>"true"}, "number"=>"2.0.0.pre",
|
14
|
+
"summary"=>"Logstash Output to Elasticsearch", "platform"=>"java", "ruby_version"=>">= 0", "prerelease"=>true,
|
15
|
+
"licenses"=>["apache-2.0"], "requirements"=>[], "sha"=>"194b27099c13605a882a3669e2363fdecccaab1de48dd44b0cda648dd5516799"},
|
16
|
+
{ "authors"=>"Elastic", "built_at"=>"2015-08-10T00:00:00.000Z", "description"=>"Output events to elasticsearch",
|
17
|
+
"downloads_count"=>1638, "metadata"=>{"logstash_group"=>"output", "logstash_plugin"=>"true"}, "number"=>"1.0.7",
|
18
|
+
"summary"=>"Logstash Output to Elasticsearch", "platform"=>"java", "ruby_version"=>">= 0", "prerelease"=>false,
|
19
|
+
"licenses"=>["apache-2.0"], "requirements"=>[], "sha"=>"194b27099c13605a882a3669e2363fdecccaab1de48dd44b0cda648dd5516799"},
|
20
|
+
{ "authors"=>"Elastic", "built_at"=>"2015-08-09T00:00:00.000Z", "description"=>"Output events to elasticsearch",
|
21
|
+
"downloads_count"=>1638, "metadata"=>{"logstash_group"=>"output", "logstash_plugin"=>"true"}, "number"=>"1.0.4",
|
22
|
+
"summary"=>"Logstash Output to Elasticsearch", "platform"=>"java", "ruby_version"=>">= 0", "prerelease"=>false,
|
23
|
+
"licenses"=>["apache-2.0"], "requirements"=>[], "sha"=>"194b27099c13605a882a3669e2363fdecccaab1de48dd44b0cda648dd5516799"} ]
|
24
|
+
end
|
25
|
+
|
26
|
+
before(:each) do
|
27
|
+
allow(Gems).to receive(:versions).with(plugin_name).and_return(version_data)
|
28
|
+
end
|
29
|
+
|
30
|
+
context "fetch plugin info" do
|
31
|
+
it "should search for the last version infomation non prerelease" do
|
32
|
+
version_info = LogStash::PluginManager.fetch_latest_version_info(plugin_name)
|
33
|
+
expect(version_info["number"]).to eq("1.0.7")
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
it "should search for the last version infomation with prerelease" do
|
38
|
+
version_info = LogStash::PluginManager.fetch_latest_version_info(plugin_name, :pre => true)
|
39
|
+
expect(version_info["number"]).to eq("2.0.0.pre")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "a logstash_plugin validation" do
|
45
|
+
let(:plugin) { "foo" }
|
46
|
+
let(:version) { "9.0.0.0" }
|
47
|
+
|
48
|
+
let(:sources) { ["http://source.01", "http://source.02"] }
|
49
|
+
let(:options) { {:rubygems_source => sources} }
|
50
|
+
|
51
|
+
let(:gemset) { double("gemset") }
|
52
|
+
let(:gemfile) { double("gemfile") }
|
53
|
+
let(:dep) { double("dep") }
|
54
|
+
let(:fetcher) { double("fetcher") }
|
55
|
+
|
56
|
+
before(:each) do
|
57
|
+
allow(gemfile).to receive(:gemset).and_return(gemset)
|
58
|
+
allow(gemset).to receive(:sources).and_return(sources)
|
59
|
+
expect(fetcher).to receive(:spec_for_dependency).and_return([[],[]])
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should load all available sources" do
|
63
|
+
expect(subject).to receive(:plugin_file?).and_return(false)
|
64
|
+
expect(Gem::Dependency).to receive(:new).and_return(dep)
|
65
|
+
expect(Gem::SpecFetcher).to receive(:fetcher).and_return(fetcher)
|
66
|
+
|
67
|
+
subject.logstash_plugin?(plugin, version, options)
|
68
|
+
expect(Gem.sources.map { |source| source }).to eq(sources)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
require 'ostruct'
|
4
|
+
require "bootstrap/util/compress"
|
5
|
+
|
6
|
+
describe LogStash::Util::Zip do
|
7
|
+
|
8
|
+
subject { Class.new { extend LogStash::Util::Zip } }
|
9
|
+
|
10
|
+
context "#extraction" do
|
11
|
+
|
12
|
+
let(:source) { File.join(File.expand_path("."), "source_file.zip") }
|
13
|
+
let(:target) { File.expand_path("target_dir") }
|
14
|
+
|
15
|
+
it "raise an exception if the target dir exist" do
|
16
|
+
allow(File).to receive(:exist?).with(target).and_return(true)
|
17
|
+
expect { subject.extract(source, target) }.to raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:zip_file) do
|
21
|
+
[ "foo", "bar", "zoo" ].inject([]) do |acc, name|
|
22
|
+
acc << OpenStruct.new(:name => name)
|
23
|
+
acc
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "extract the list of entries from a zip file" do
|
28
|
+
allow(Zip::File).to receive(:open).with(source).and_yield(zip_file)
|
29
|
+
expect(FileUtils).to receive(:mkdir_p).exactly(3).times
|
30
|
+
expect(zip_file).to receive(:extract).exactly(3).times
|
31
|
+
subject.extract(source, target)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "#compression" do
|
36
|
+
|
37
|
+
let(:target) { File.join(File.expand_path("."), "target_file.zip") }
|
38
|
+
let(:source) { File.expand_path("source_dir") }
|
39
|
+
|
40
|
+
it "raise an exception if the target file exist" do
|
41
|
+
allow(File).to receive(:exist?).with(target).and_return(true)
|
42
|
+
expect { subject.compress(source, target) }.to raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:dir_files) do
|
46
|
+
[ "foo", "bar", "zoo" ]
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:zip_file) { Class.new }
|
50
|
+
|
51
|
+
it "add a dir to a zip file" do
|
52
|
+
allow(Zip::File).to receive(:open).with(target, ::Zip::File::CREATE).and_yield(zip_file)
|
53
|
+
allow(Dir).to receive(:glob).and_return(dir_files)
|
54
|
+
expect(zip_file).to receive(:add).exactly(3).times
|
55
|
+
subject.compress(source, target)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe LogStash::Util::Tar do
|
61
|
+
|
62
|
+
subject { Class.new { extend LogStash::Util::Tar } }
|
63
|
+
|
64
|
+
context "#extraction" do
|
65
|
+
|
66
|
+
let(:source) { File.join(File.expand_path("."), "source_file.tar.gz") }
|
67
|
+
let(:target) { File.expand_path("target_dir") }
|
68
|
+
|
69
|
+
it "raise an exception if the target dir exist" do
|
70
|
+
allow(File).to receive(:exist?).with(target).and_return(true)
|
71
|
+
expect { subject.extract(source, target) }.to raise_error
|
72
|
+
end
|
73
|
+
|
74
|
+
let(:gzip_file) { Class.new }
|
75
|
+
|
76
|
+
let(:tar_file) do
|
77
|
+
[ "foo", "bar", "zoo" ].inject([]) do |acc, name|
|
78
|
+
acc << OpenStruct.new(:full_name => name)
|
79
|
+
acc
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it "extract the list of entries from a tar.gz file" do
|
84
|
+
allow(Zlib::GzipReader).to receive(:open).with(source).and_yield(gzip_file)
|
85
|
+
allow(Gem::Package::TarReader).to receive(:new).with(gzip_file).and_yield(tar_file)
|
86
|
+
|
87
|
+
expect(FileUtils).to receive(:mkdir).with(target)
|
88
|
+
expect(File).to receive(:open).exactly(3).times
|
89
|
+
subject.extract(source, target)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context "#compression" do
|
94
|
+
|
95
|
+
let(:target) { File.join(File.expand_path("."), "target_file.tar.gz") }
|
96
|
+
let(:source) { File.expand_path("source_dir") }
|
97
|
+
|
98
|
+
it "raise an exception if the target file exist" do
|
99
|
+
allow(File).to receive(:exist?).with(target).and_return(true)
|
100
|
+
expect { subject.compress(source, target) }.to raise_error
|
101
|
+
end
|
102
|
+
|
103
|
+
let(:dir_files) do
|
104
|
+
[ "foo", "bar", "zoo" ]
|
105
|
+
end
|
106
|
+
|
107
|
+
let(:tar_file) { Class.new }
|
108
|
+
let(:tar) { Class.new }
|
109
|
+
|
110
|
+
it "add a dir to a tgz file" do
|
111
|
+
allow(Stud::Temporary).to receive(:file).and_yield(tar_file)
|
112
|
+
allow(Gem::Package::TarWriter).to receive(:new).with(tar_file).and_yield(tar)
|
113
|
+
allow(Dir).to receive(:glob).and_return(dir_files)
|
114
|
+
expect(File).to receive(:stat).exactly(3).times.and_return(OpenStruct.new(:mode => "rw"))
|
115
|
+
expect(tar).to receive(:add_file).exactly(3).times
|
116
|
+
expect(tar_file).to receive(:rewind)
|
117
|
+
expect(subject).to receive(:gzip).with(target, tar_file)
|
118
|
+
subject.compress(source, target)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -10,7 +10,7 @@ describe LogStash::Util::DefaultsPrinter do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
let(:workers) { 1 }
|
13
|
-
let(:expected) { "
|
13
|
+
let(:expected) { "Settings: User set filter workers: #{workers}" }
|
14
14
|
let(:settings) { {} }
|
15
15
|
|
16
16
|
describe 'class methods API' do
|
@@ -19,13 +19,13 @@ describe LogStash::Util::DefaultsPrinter do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
context 'when the settings hash is empty' do
|
22
|
+
let(:expected) { "Settings: " }
|
22
23
|
it_behaves_like "a defaults printer"
|
23
24
|
end
|
24
25
|
|
25
26
|
context 'when the settings hash has content' do
|
26
27
|
let(:workers) { 42 }
|
27
28
|
let(:settings) { {'filter-workers' => workers} }
|
28
|
-
|
29
29
|
it_behaves_like "a defaults printer"
|
30
30
|
end
|
31
31
|
end
|
@@ -36,6 +36,7 @@ describe LogStash::Util::DefaultsPrinter do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'when the settings hash is empty' do
|
39
|
+
let(:expected) { "Settings: " }
|
39
40
|
it_behaves_like "a defaults printer"
|
40
41
|
end
|
41
42
|
|
@@ -3,24 +3,43 @@ require "spec_helper"
|
|
3
3
|
require "logstash/util/worker_threads_default_printer"
|
4
4
|
|
5
5
|
describe LogStash::Util::WorkerThreadsDefaultPrinter do
|
6
|
-
let(:settings)
|
6
|
+
let(:settings) { {} }
|
7
7
|
let(:collector) { [] }
|
8
8
|
|
9
9
|
subject { described_class.new(settings) }
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
before { subject.visit(collector) }
|
12
|
+
|
13
|
+
describe "the #visit method" do
|
14
|
+
context 'when the settings hash is empty' do
|
15
|
+
it 'adds nothing to the collector' do
|
16
|
+
subject.visit(collector)
|
17
|
+
expect(collector).to eq([])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the settings hash has both user and default content' do
|
22
|
+
let(:settings) { {'filter-workers' => 42, 'default-filter-workers' => 5} }
|
23
|
+
|
24
|
+
it 'adds two strings' do
|
25
|
+
expect(collector).to eq(["User set filter workers: 42", "Default filter workers: 5"])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when the settings hash has only user content' do
|
30
|
+
let(:settings) { {'filter-workers' => 42} }
|
31
|
+
|
32
|
+
it 'adds a string with user set filter workers' do
|
33
|
+
expect(collector.first).to eq("User set filter workers: 42")
|
34
|
+
end
|
15
35
|
end
|
16
|
-
end
|
17
36
|
|
18
|
-
|
19
|
-
|
37
|
+
context 'when the settings hash has only default content' do
|
38
|
+
let(:settings) { {'default-filter-workers' => 5} }
|
20
39
|
|
21
|
-
|
22
|
-
|
23
|
-
|
40
|
+
it 'adds a string with default filter workers' do
|
41
|
+
expect(collector.first).to eq("Default filter workers: 5")
|
42
|
+
end
|
24
43
|
end
|
25
44
|
end
|
26
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.
|
4
|
+
version: 2.1.0.snapshot2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Jordan Sissel
|
@@ -10,190 +10,204 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-11-
|
13
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.7.0
|
16
21
|
name: cabin
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
17
24
|
version_requirements: !ruby/object:Gem::Requirement
|
18
25
|
requirements:
|
19
26
|
- - ~>
|
20
27
|
- !ruby/object:Gem::Version
|
21
28
|
version: 0.7.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
22
30
|
requirement: !ruby/object:Gem::Requirement
|
23
31
|
requirements:
|
24
32
|
- - ~>
|
25
33
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
34
|
+
version: 0.10.1
|
35
|
+
name: pry
|
27
36
|
prerelease: false
|
28
37
|
type: :runtime
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: pry
|
31
38
|
version_requirements: !ruby/object:Gem::Requirement
|
32
39
|
requirements:
|
33
40
|
- - ~>
|
34
41
|
- !ruby/object:Gem::Version
|
35
42
|
version: 0.10.1
|
43
|
+
- !ruby/object:Gem::Dependency
|
36
44
|
requirement: !ruby/object:Gem::Requirement
|
37
45
|
requirements:
|
38
46
|
- - ~>
|
39
47
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
48
|
+
version: 0.0.19
|
49
|
+
name: stud
|
41
50
|
prerelease: false
|
42
51
|
type: :runtime
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: stud
|
45
52
|
version_requirements: !ruby/object:Gem::Requirement
|
46
53
|
requirements:
|
47
54
|
- - ~>
|
48
55
|
- !ruby/object:Gem::Version
|
49
56
|
version: 0.0.19
|
57
|
+
- !ruby/object:Gem::Dependency
|
50
58
|
requirement: !ruby/object:Gem::Requirement
|
51
59
|
requirements:
|
52
60
|
- - ~>
|
53
61
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
62
|
+
version: 0.6.5
|
63
|
+
name: clamp
|
55
64
|
prerelease: false
|
56
65
|
type: :runtime
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: clamp
|
59
66
|
version_requirements: !ruby/object:Gem::Requirement
|
60
67
|
requirements:
|
61
68
|
- - ~>
|
62
69
|
- !ruby/object:Gem::Version
|
63
70
|
version: 0.6.5
|
71
|
+
- !ruby/object:Gem::Dependency
|
64
72
|
requirement: !ruby/object:Gem::Requirement
|
65
73
|
requirements:
|
66
|
-
- -
|
74
|
+
- - '='
|
67
75
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
76
|
+
version: 0.0.4
|
77
|
+
name: filesize
|
69
78
|
prerelease: false
|
70
79
|
type: :runtime
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: filesize
|
73
80
|
version_requirements: !ruby/object:Gem::Requirement
|
74
81
|
requirements:
|
75
82
|
- - '='
|
76
83
|
- !ruby/object:Gem::Version
|
77
84
|
version: 0.0.4
|
85
|
+
- !ruby/object:Gem::Dependency
|
78
86
|
requirement: !ruby/object:Gem::Requirement
|
79
87
|
requirements:
|
80
|
-
- -
|
88
|
+
- - ~>
|
81
89
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
90
|
+
version: 0.8.3
|
91
|
+
name: gems
|
83
92
|
prerelease: false
|
84
93
|
type: :runtime
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: gems
|
87
94
|
version_requirements: !ruby/object:Gem::Requirement
|
88
95
|
requirements:
|
89
96
|
- - ~>
|
90
97
|
- !ruby/object:Gem::Version
|
91
98
|
version: 0.8.3
|
99
|
+
- !ruby/object:Gem::Dependency
|
92
100
|
requirement: !ruby/object:Gem::Requirement
|
93
101
|
requirements:
|
94
|
-
- -
|
102
|
+
- - '='
|
95
103
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
104
|
+
version: 0.9.2
|
105
|
+
name: concurrent-ruby
|
97
106
|
prerelease: false
|
98
107
|
type: :runtime
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: concurrent-ruby
|
101
108
|
version_requirements: !ruby/object:Gem::Requirement
|
102
109
|
requirements:
|
103
110
|
- - '='
|
104
111
|
- !ruby/object:Gem::Version
|
105
112
|
version: 0.9.2
|
113
|
+
- !ruby/object:Gem::Dependency
|
106
114
|
requirement: !ruby/object:Gem::Requirement
|
107
115
|
requirements:
|
108
|
-
- - '
|
116
|
+
- - '>='
|
109
117
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.9.
|
118
|
+
version: 0.9.11
|
119
|
+
name: jruby-openssl
|
111
120
|
prerelease: false
|
112
121
|
type: :runtime
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: jruby-openssl
|
115
122
|
version_requirements: !ruby/object:Gem::Requirement
|
116
123
|
requirements:
|
117
124
|
- - '>='
|
118
125
|
- !ruby/object:Gem::Version
|
119
126
|
version: 0.9.11
|
127
|
+
- !ruby/object:Gem::Dependency
|
120
128
|
requirement: !ruby/object:Gem::Requirement
|
121
129
|
requirements:
|
122
|
-
- -
|
130
|
+
- - <
|
123
131
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
132
|
+
version: 1.5.0
|
133
|
+
name: treetop
|
125
134
|
prerelease: false
|
126
135
|
type: :runtime
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: treetop
|
129
136
|
version_requirements: !ruby/object:Gem::Requirement
|
130
137
|
requirements:
|
131
138
|
- - <
|
132
139
|
- !ruby/object:Gem::Version
|
133
140
|
version: 1.5.0
|
141
|
+
- !ruby/object:Gem::Dependency
|
134
142
|
requirement: !ruby/object:Gem::Requirement
|
135
143
|
requirements:
|
136
|
-
- -
|
144
|
+
- - '='
|
137
145
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
146
|
+
version: 0.6.9
|
147
|
+
name: i18n
|
139
148
|
prerelease: false
|
140
149
|
type: :runtime
|
141
|
-
- !ruby/object:Gem::Dependency
|
142
|
-
name: i18n
|
143
150
|
version_requirements: !ruby/object:Gem::Requirement
|
144
151
|
requirements:
|
145
152
|
- - '='
|
146
153
|
- !ruby/object:Gem::Version
|
147
154
|
version: 0.6.9
|
155
|
+
- !ruby/object:Gem::Dependency
|
148
156
|
requirement: !ruby/object:Gem::Requirement
|
149
157
|
requirements:
|
150
|
-
- -
|
158
|
+
- - ~>
|
151
159
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
160
|
+
version: 0.5.4
|
161
|
+
name: minitar
|
153
162
|
prerelease: false
|
154
163
|
type: :runtime
|
155
|
-
- !ruby/object:Gem::Dependency
|
156
|
-
name: minitar
|
157
164
|
version_requirements: !ruby/object:Gem::Requirement
|
158
165
|
requirements:
|
159
166
|
- - ~>
|
160
167
|
- !ruby/object:Gem::Version
|
161
168
|
version: 0.5.4
|
169
|
+
- !ruby/object:Gem::Dependency
|
162
170
|
requirement: !ruby/object:Gem::Requirement
|
163
171
|
requirements:
|
164
172
|
- - ~>
|
165
173
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
174
|
+
version: 1.1.7
|
175
|
+
name: rubyzip
|
167
176
|
prerelease: false
|
168
177
|
type: :runtime
|
169
|
-
- !ruby/object:Gem::Dependency
|
170
|
-
name: thread_safe
|
171
178
|
version_requirements: !ruby/object:Gem::Requirement
|
172
179
|
requirements:
|
173
180
|
- - ~>
|
174
181
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
182
|
+
version: 1.1.7
|
183
|
+
- !ruby/object:Gem::Dependency
|
176
184
|
requirement: !ruby/object:Gem::Requirement
|
177
185
|
requirements:
|
178
186
|
- - ~>
|
179
187
|
- !ruby/object:Gem::Version
|
180
188
|
version: 0.3.5
|
189
|
+
name: thread_safe
|
181
190
|
prerelease: false
|
182
191
|
type: :runtime
|
183
|
-
- !ruby/object:Gem::Dependency
|
184
|
-
name: jrjackson
|
185
192
|
version_requirements: !ruby/object:Gem::Requirement
|
186
193
|
requirements:
|
187
194
|
- - ~>
|
188
195
|
- !ruby/object:Gem::Version
|
189
|
-
version: 0.3.
|
196
|
+
version: 0.3.5
|
197
|
+
- !ruby/object:Gem::Dependency
|
190
198
|
requirement: !ruby/object:Gem::Requirement
|
191
199
|
requirements:
|
192
200
|
- - ~>
|
193
201
|
- !ruby/object:Gem::Version
|
194
202
|
version: 0.3.7
|
203
|
+
name: jrjackson
|
195
204
|
prerelease: false
|
196
205
|
type: :runtime
|
206
|
+
version_requirements: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ~>
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: 0.3.7
|
197
211
|
description: The core components of logstash, the scalable log and event management tool
|
198
212
|
email:
|
199
213
|
- jls@semicomplete.com
|
@@ -277,11 +291,14 @@ files:
|
|
277
291
|
- spec/logstash/agent_spec.rb
|
278
292
|
- spec/logstash/patches_spec.rb
|
279
293
|
- spec/outputs/base_spec.rb
|
280
|
-
- spec/
|
294
|
+
- spec/plugin_manager/install_spec.rb
|
295
|
+
- spec/plugin_manager/update_spec.rb
|
296
|
+
- spec/plugin_manager/util_spec.rb
|
281
297
|
- spec/spec_helper.rb
|
282
298
|
- spec/util/accessors_spec.rb
|
283
299
|
- spec/util/buftok_spec.rb
|
284
300
|
- spec/util/charset_spec.rb
|
301
|
+
- spec/util/compress_spec.rb
|
285
302
|
- spec/util/defaults_printer_spec.rb
|
286
303
|
- spec/util/gemfile_spec.rb
|
287
304
|
- spec/util/java_version_spec.rb
|
@@ -336,11 +353,14 @@ test_files:
|
|
336
353
|
- spec/logstash/agent_spec.rb
|
337
354
|
- spec/logstash/patches_spec.rb
|
338
355
|
- spec/outputs/base_spec.rb
|
339
|
-
- spec/
|
356
|
+
- spec/plugin_manager/install_spec.rb
|
357
|
+
- spec/plugin_manager/update_spec.rb
|
358
|
+
- spec/plugin_manager/util_spec.rb
|
340
359
|
- spec/spec_helper.rb
|
341
360
|
- spec/util/accessors_spec.rb
|
342
361
|
- spec/util/buftok_spec.rb
|
343
362
|
- spec/util/charset_spec.rb
|
363
|
+
- spec/util/compress_spec.rb
|
344
364
|
- spec/util/defaults_printer_spec.rb
|
345
365
|
- spec/util/gemfile_spec.rb
|
346
366
|
- spec/util/java_version_spec.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "spec_helper"
|
3
|
-
require "pluginmanager/util"
|
4
|
-
require "gems"
|
5
|
-
|
6
|
-
describe LogStash::PluginManager do
|
7
|
-
|
8
|
-
let(:plugin_name) { "logstash-output-elasticsearch" }
|
9
|
-
|
10
|
-
let(:version_data) do
|
11
|
-
[ { "authors"=>"Elastic", "built_at"=>"2015-08-11T00:00:00.000Z", "description"=>"Output events to elasticsearch",
|
12
|
-
"downloads_count"=>1638, "metadata"=>{"logstash_group"=>"output", "logstash_plugin"=>"true"}, "number"=>"2.0.0.pre",
|
13
|
-
"summary"=>"Logstash Output to Elasticsearch", "platform"=>"java", "ruby_version"=>">= 0", "prerelease"=>true,
|
14
|
-
"licenses"=>["apache-2.0"], "requirements"=>[], "sha"=>"194b27099c13605a882a3669e2363fdecccaab1de48dd44b0cda648dd5516799"},
|
15
|
-
{ "authors"=>"Elastic", "built_at"=>"2015-08-10T00:00:00.000Z", "description"=>"Output events to elasticsearch",
|
16
|
-
"downloads_count"=>1638, "metadata"=>{"logstash_group"=>"output", "logstash_plugin"=>"true"}, "number"=>"1.0.7",
|
17
|
-
"summary"=>"Logstash Output to Elasticsearch", "platform"=>"java", "ruby_version"=>">= 0", "prerelease"=>false,
|
18
|
-
"licenses"=>["apache-2.0"], "requirements"=>[], "sha"=>"194b27099c13605a882a3669e2363fdecccaab1de48dd44b0cda648dd5516799"},
|
19
|
-
{ "authors"=>"Elastic", "built_at"=>"2015-08-09T00:00:00.000Z", "description"=>"Output events to elasticsearch",
|
20
|
-
"downloads_count"=>1638, "metadata"=>{"logstash_group"=>"output", "logstash_plugin"=>"true"}, "number"=>"1.0.4",
|
21
|
-
"summary"=>"Logstash Output to Elasticsearch", "platform"=>"java", "ruby_version"=>">= 0", "prerelease"=>false,
|
22
|
-
"licenses"=>["apache-2.0"], "requirements"=>[], "sha"=>"194b27099c13605a882a3669e2363fdecccaab1de48dd44b0cda648dd5516799"} ]
|
23
|
-
end
|
24
|
-
|
25
|
-
before(:each) do
|
26
|
-
allow(Gems).to receive(:versions).with(plugin_name).and_return(version_data)
|
27
|
-
end
|
28
|
-
|
29
|
-
context "fetch plugin info" do
|
30
|
-
|
31
|
-
it "should search for the last version infomation non prerelease" do
|
32
|
-
version_info = LogStash::PluginManager.fetch_latest_version_info(plugin_name)
|
33
|
-
expect(version_info["number"]).to eq("1.0.7")
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
it "should search for the last version infomation with prerelease" do
|
38
|
-
version_info = LogStash::PluginManager.fetch_latest_version_info(plugin_name, :pre => true)
|
39
|
-
expect(version_info["number"]).to eq("2.0.0.pre")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|