fluent-plugin-elasticsearch 4.0.4 → 4.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,9 @@
1
- require 'helper'
1
+ require_relative '../helper'
2
2
  require 'date'
3
3
  require 'fluent/test/helpers'
4
4
  require 'fluent/test/driver/output'
5
5
  require 'flexmock/test_unit'
6
+ require 'fluent/plugin/out_elasticsearch_dynamic'
6
7
 
7
8
  class ElasticsearchOutputDynamic < Test::Unit::TestCase
8
9
  include FlexMock::TestCase
@@ -12,7 +13,6 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
12
13
 
13
14
  def setup
14
15
  Fluent::Test.setup
15
- require 'fluent/plugin/out_elasticsearch_dynamic'
16
16
  @driver = nil
17
17
  end
18
18
 
@@ -101,7 +101,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
101
101
  assert_nil instance.ssl_max_version
102
102
  assert_nil instance.ssl_min_version
103
103
  if Fluent::Plugin::ElasticsearchTLS::USE_TLS_MINMAX_VERSION
104
- assert_equal({max_version: OpenSSL::SSL::TLS1_VERSION, min_version: OpenSSL::SSL::TLS1_VERSION},
104
+ assert_equal({max_version: OpenSSL::SSL::TLS1_3_VERSION, min_version: OpenSSL::SSL::TLS1_2_VERSION},
105
105
  instance.ssl_version_options)
106
106
  else
107
107
  assert_equal({version: Fluent::Plugin::ElasticsearchTLS::DEFAULT_VERSION},
@@ -118,6 +118,8 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
118
118
  end
119
119
 
120
120
  test 'configure compression' do
121
+ omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.2.0")
122
+
121
123
  config = %{
122
124
  compression_level best_compression
123
125
  }
@@ -127,6 +129,8 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
127
129
  end
128
130
 
129
131
  test 'check compression strategy' do
132
+ omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.2.0")
133
+
130
134
  config = %{
131
135
  compression_level best_speed
132
136
  }
@@ -136,21 +140,43 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
136
140
  end
137
141
 
138
142
  test 'check content-encoding header with compression' do
143
+ omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.2.0")
144
+
139
145
  config = %{
140
146
  compression_level best_compression
141
147
  }
142
148
  instance = driver(config).instance
143
149
 
144
- assert_equal "gzip", instance.client.transport.options[:transport_options][:headers]["Content-Encoding"]
150
+ assert_equal nil, instance.client.transport.options[:transport_options][:headers]["Content-Encoding"]
151
+
152
+ stub_request(:post, "http://localhost:9200/_bulk").
153
+ to_return(status: 200, body: "", headers: {})
154
+ driver.run(default_tag: 'test') do
155
+ driver.feed(sample_record)
156
+ end
157
+ compressable = instance.compressable_connection
158
+
159
+ assert_equal "gzip", instance.client(nil, compressable).transport.options[:transport_options][:headers]["Content-Encoding"]
145
160
  end
146
161
 
147
162
  test 'check compression option is passed to transport' do
163
+ omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.2.0")
164
+
148
165
  config = %{
149
166
  compression_level best_compression
150
167
  }
151
168
  instance = driver(config).instance
152
169
 
153
- assert_equal true, instance.client.transport.options[:compression]
170
+ assert_equal false, instance.client.transport.options[:compression]
171
+
172
+ stub_request(:post, "http://localhost:9200/_bulk").
173
+ to_return(status: 200, body: "", headers: {})
174
+ driver.run(default_tag: 'test') do
175
+ driver.feed(sample_record)
176
+ end
177
+ compressable = instance.compressable_connection
178
+
179
+ assert_equal true, instance.client(nil, compressable).transport.options[:compression]
154
180
  end
155
181
 
156
182
  test 'configure Content-Type' do
@@ -341,6 +367,8 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
341
367
  end
342
368
 
343
369
  def test_writes_to_default_index_with_compression
370
+ omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::Elasticsearch::Transport::VERSION) < Gem::Version.create("7.2.0")
371
+
344
372
  config = %[
345
373
  compression_level default_compression
346
374
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-02-19 00:00:00.000000000 Z
13
+ date: 2020-05-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd
@@ -135,6 +135,9 @@ extra_rdoc_files: []
135
135
  files:
136
136
  - ".coveralls.yml"
137
137
  - ".editorconfig"
138
+ - ".github/workflows/linux.yml"
139
+ - ".github/workflows/macos.yml"
140
+ - ".github/workflows/windows.yml"
138
141
  - ".gitignore"
139
142
  - ".travis.yml"
140
143
  - CONTRIBUTING.md
@@ -148,7 +151,8 @@ files:
148
151
  - Rakefile
149
152
  - appveyor.yml
150
153
  - fluent-plugin-elasticsearch.gemspec
151
- - gemfiles/Gemfile.ilm
154
+ - gemfiles/Gemfile.elasticsearch.v6
155
+ - gemfiles/Gemfile.without.ilm
152
156
  - lib/fluent/log-ext.rb
153
157
  - lib/fluent/plugin/default-ilm-policy.json
154
158
  - lib/fluent/plugin/elasticsearch_constants.rb
@@ -170,6 +174,7 @@ files:
170
174
  - test/plugin/test_elasticsearch_tls.rb
171
175
  - test/plugin/test_filter_elasticsearch_genid.rb
172
176
  - test/plugin/test_in_elasticsearch.rb
177
+ - test/plugin/test_oj_serializer.rb
173
178
  - test/plugin/test_out_elasticsearch.rb
174
179
  - test/plugin/test_out_elasticsearch_dynamic.rb
175
180
  - test/plugin/test_template.json
@@ -206,6 +211,7 @@ test_files:
206
211
  - test/plugin/test_elasticsearch_tls.rb
207
212
  - test/plugin/test_filter_elasticsearch_genid.rb
208
213
  - test/plugin/test_in_elasticsearch.rb
214
+ - test/plugin/test_oj_serializer.rb
209
215
  - test/plugin/test_out_elasticsearch.rb
210
216
  - test/plugin/test_out_elasticsearch_dynamic.rb
211
217
  - test/plugin/test_template.json