logstash-output-elasticsearch 8.1.1-java → 8.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,9 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
21
21
 
22
22
  allow(::Manticore::Client).to receive(:new).and_return(manticore_double)
23
23
 
24
+ allow(subject).to receive(:connected_es_versions).with(any_args).and_return(["0.0.0"])
25
+ allow(subject).to receive(:get_es_version).with(any_args).and_return("0.0.0")
26
+
24
27
  subject.start
25
28
  end
26
29
 
@@ -132,7 +132,7 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
132
132
  }
133
133
 
134
134
  it "returns the hash response" do
135
- expect(subject.pool).to receive(:get).with(path, nil).and_return([nil, get_response])
135
+ expect(subject.pool).to receive(:get).with(path, nil).and_return(get_response)
136
136
  expect(subject.get(path)["body"]).to eq(body)
137
137
  end
138
138
  end
@@ -6,32 +6,21 @@ require "json"
6
6
  describe LogStash::Outputs::ElasticSearch::TemplateManager do
7
7
 
8
8
  describe ".get_es_major_version" do
9
- let(:es_1x_version) { '{ "number" : "1.7.0", "build_hash" : "929b9739cae115e73c346cb5f9a6f24ba735a743", "build_timestamp" : "2015-07-16T14:31:07Z", "build_snapshot" : false, "lucene_version" : "4.10.4" }' }
10
- let(:es_2x_version) { '{ "number" : "2.3.4", "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f", "build_timestamp" : "2016-06-30T11:24:31Z", "build_snapshot" : false, "lucene_version" : "5.5.0" }' }
11
- let(:es_5x_version) { '{ "number" : "5.0.0-alpha4", "build_hash" : "b0da471", "build_date" : "2016-06-22T12:33:48.164Z", "build_snapshot" : false, "lucene_version" : "6.1.0" }' }
12
9
  let(:client) { double("client") }
13
- context "elasticsearch 1.x" do
14
- before(:each) do
15
- allow(client).to receive(:get_version).and_return(JSON.parse(es_1x_version))
16
- end
17
- it "detects major version is 1" do
18
- expect(described_class.get_es_major_version(client)).to eq("1")
19
- end
10
+
11
+ before(:each) do
12
+ allow(client).to receive(:connected_es_versions).and_return(["5.3.0"])
20
13
  end
21
- context "elasticsearch 2.x" do
22
- before(:each) do
23
- allow(client).to receive(:get_version).and_return(JSON.parse(es_2x_version))
24
- end
25
- it "detects major version is 2" do
26
- expect(described_class.get_es_major_version(client)).to eq("2")
27
- end
14
+
15
+ it "picks the largest major version" do
16
+ expect(described_class.get_es_major_version(client)).to eq(5)
28
17
  end
29
- context "elasticsearch 5.x" do
18
+ context "if there are nodes with multiple major versions" do
30
19
  before(:each) do
31
- allow(client).to receive(:get_version).and_return(JSON.parse(es_5x_version))
20
+ allow(client).to receive(:connected_es_versions).and_return(["5.3.0", "6.0.0"])
32
21
  end
33
- it "detects major version is 5" do
34
- expect(described_class.get_es_major_version(client)).to eq("5")
22
+ it "picks the largest major version" do
23
+ expect(described_class.get_es_major_version(client)).to eq(6)
35
24
  end
36
25
  end
37
26
  end
@@ -39,19 +28,18 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
39
28
  describe ".default_template_path" do
40
29
  context "elasticsearch 1.x" do
41
30
  it "chooses the 2x template" do
42
- expect(described_class.default_template_path("1")).to match(/elasticsearch-template-es2x.json/)
31
+ expect(described_class.default_template_path(1)).to match(/elasticsearch-template-es2x.json/)
43
32
  end
44
33
  end
45
34
  context "elasticsearch 2.x" do
46
35
  it "chooses the 2x template" do
47
- expect(described_class.default_template_path("2")).to match(/elasticsearch-template-es2x.json/)
36
+ expect(described_class.default_template_path(2)).to match(/elasticsearch-template-es2x.json/)
48
37
  end
49
38
  end
50
39
  context "elasticsearch 5.x" do
51
40
  it "chooses the 5x template" do
52
- expect(described_class.default_template_path("5")).to match(/elasticsearch-template-es5x.json/)
41
+ expect(described_class.default_template_path(5)).to match(/elasticsearch-template-es5x.json/)
53
42
  end
54
43
  end
55
44
  end
56
-
57
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.1
4
+ version: 8.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: 2017-08-21 00:00:00.000000000 Z
11
+ date: 2017-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement