Skip to content

Commit bbade7b

Browse files
committed
Continue fixing tests
Correct type logic for join field based parent indexer tests Remove 'bad type' tests that can no longer be exercised due to removal of custom type code Fixes #828
1 parent 1aedbc6 commit bbade7b

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

spec/integration/outputs/index_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
}
1313
}
1414
let(:index) { 10.times.collect { rand(10).to_s }.join("") }
15-
let(:type) { 10.times.collect { rand(10).to_s }.join("") }
15+
let(:type) { ESHelper.es_version_satisfies?("<= 6.3") ? "doc" : "_doc" }
16+
1617
subject { LogStash::Outputs::ElasticSearch.new(config) }
1718

1819
before do

spec/integration/outputs/parent_spec.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
shared_examples "a join field based parent indexer" do
88
let(:index) { 10.times.collect { rand(10).to_s }.join("") }
99

10-
let(:type) do
11-
if ESHelper.es_version_satisfies?('<7')
12-
10.times.collect { rand(10).to_s }.join("")
13-
else
14-
"_doc"
15-
end
16-
end
10+
let(:type) { ESHelper.es_version_satisfies?("<= 6.3") ? "doc" : "_doc" }
1711

1812
let(:event_count) { 10000 + rand(500) }
1913
let(:parent) { "not_implemented" }

spec/unit/outputs/elasticsearch_spec.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,6 @@
6363
expect(subject.send(:get_event_type, LogStash::Event.new("type" => "foo"))).to eql("doc")
6464
end
6565
end
66-
67-
context "with a bad type event field in a < 6.0 es cluster" do
68-
let(:maximum_seen_major_version) { 5 }
69-
let(:type_arg) { ["foo"] }
70-
let(:result) { subject.send(:get_event_type, LogStash::Event.new("type" => type_arg)) }
71-
72-
before do
73-
allow(subject.instance_variable_get(:@logger)).to receive(:warn)
74-
result
75-
end
76-
77-
it "should call @logger.warn and return nil" do
78-
expect(subject.instance_variable_get(:@logger)).to have_received(:warn).with(/Bad event type!/, anything).once
79-
end
80-
81-
it "should set the type to the stringified value" do
82-
expect(result).to eql(type_arg.to_s)
83-
end
84-
end
8566
end
8667

8768
describe "with auth" do

0 commit comments

Comments
 (0)