elasticsearch-transport 7.14.1.pre → 7.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69804f86ed3bff5b4277e47adb97b727e3324cc2f5a7a7da2155266433d29b39
4
- data.tar.gz: 4ed9685fca9531e8caff5396cfefe5b7f2e429b2b9b2a48dc325e73d3bae7c9f
3
+ metadata.gz: d57ef8d3855aa9061389ac3953409508cc4f0fac7950aeb4528ec3330c3d79bb
4
+ data.tar.gz: 9281fa9aeb210e67f9b6156bf554724f1910f9698103b4b2beafe7307255ea05
5
5
  SHA512:
6
- metadata.gz: b958fb03c5494824be0c6683c751ec22cdac5d7cf270824ba62e746b93abbefc9ede940955408e8f228adb424f78364cd7452e28c965019476a65854026ad07a
7
- data.tar.gz: b2f73320b43a84a8bb1de43c6afa9d37fa162d48fe587c7a9b8b78fd3c4a010c240f6f160ccbc596bb0e393d5279aa913fa930d46e6ced540ec2b5b6982c8781
6
+ metadata.gz: e7844a2287b107ada0688c912b3089ff0919d3cdb4d4eb9c24f9a47bdac69a59fb3366affed78c51c584de3eeb73cbc75fa6aa92f811085ab0193190bd25f09b
7
+ data.tar.gz: 9a1c89327547bc96556890e486ffb2b7efcccc13f13d56b4082de7cd2998a22df26ad282fdc6521bae7edded45ac2c5f68520e87b1a9d0e1476d141f21acd5c8
@@ -272,7 +272,6 @@ module Elasticsearch
272
272
  end
273
273
 
274
274
  params = params.clone
275
-
276
275
  ignore = Array(params.delete(:ignore)).compact.map { |s| s.to_i }
277
276
 
278
277
  begin
@@ -284,9 +283,7 @@ module Elasticsearch
284
283
  end
285
284
 
286
285
  url = connection.full_url(path, params)
287
-
288
286
  response = block.call(connection, url)
289
-
290
287
  connection.healthy! if connection.failures > 0
291
288
 
292
289
  # Raise an exception so we can catch it for `retry_on_status`
@@ -336,14 +333,10 @@ module Elasticsearch
336
333
  duration = Time.now - start
337
334
 
338
335
  if response.status.to_i >= 300
339
- __log_response method, path, params, body, url, response, nil, 'N/A', duration
340
- __trace method, path, params, connection.connection.headers, body, url, response, nil, 'N/A', duration if tracer
341
-
336
+ __log_response(method, path, params, body, url, response, nil, 'N/A', duration)
337
+ __trace(method, path, params, connection_headers(connection), body, url, response, nil, 'N/A', duration) if tracer
342
338
  # Log the failure only when `ignore` doesn't match the response status
343
- unless ignore.include?(response.status.to_i)
344
- log_fatal "[#{response.status}] #{response.body}"
345
- end
346
-
339
+ log_fatal "[#{response.status}] #{response.body}" unless ignore.include?(response.status.to_i)
347
340
  __raise_transport_error response unless ignore.include?(response.status.to_i)
348
341
  end
349
342
 
@@ -354,10 +347,8 @@ module Elasticsearch
354
347
  __log_response method, path, params, body, url, response, json, took, duration
355
348
  end
356
349
 
357
- __trace method, path, params, connection.connection.headers, body, url, response, nil, 'N/A', duration if tracer
358
-
350
+ __trace(method, path, params, connection_headers(connection), body, url, response, nil, 'N/A', duration) if tracer
359
351
  warnings(response.headers['warning']) if response.headers&.[]('warning')
360
-
361
352
  Response.new response.status, json || response.body, response.headers
362
353
  ensure
363
354
  @last_request_at = Time.now
@@ -435,6 +426,14 @@ module Elasticsearch
435
426
  def warnings(warning)
436
427
  warn("warning: #{warning}")
437
428
  end
429
+
430
+ def connection_headers(connection)
431
+ if defined?(Elasticsearch::Transport::Transport::HTTP::Manticore) && self.class == Elasticsearch::Transport::Transport::HTTP::Manticore
432
+ @request_options[:headers]
433
+ else
434
+ connection.connection.headers
435
+ end
436
+ end
438
437
  end
439
438
  end
440
439
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module Transport
20
- VERSION = '7.14.1.pre'.freeze
20
+ VERSION = '7.14.1'.freeze
21
21
  end
22
22
  end
@@ -0,0 +1,43 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ require 'test_helper'
18
+
19
+ if JRUBY
20
+ require 'elasticsearch/transport/transport/http/manticore'
21
+
22
+ class Elasticsearch::Transport::ClientManticoreIntegrationTest < Elasticsearch::Test::IntegrationTestCase
23
+ context "Transport" do
24
+ setup do
25
+ @host, @port = ELASTICSEARCH_HOSTS.first.split(':')
26
+ end
27
+
28
+ shutdown do
29
+ begin; Object.send(:remove_const, :Manticore); rescue NameError; end
30
+ end
31
+
32
+ should 'allow to customize the Faraday adapter to Manticore' do
33
+ client = Elasticsearch::Transport::Client.new(
34
+ transport_class: Elasticsearch::Transport::Transport::HTTP::Manticore,
35
+ trace: true,
36
+ hosts: [ { host: @host, port: @port } ]
37
+ )
38
+ response = client.perform_request 'GET', ''
39
+ assert_respond_to(response.body, :to_hash)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -29,6 +29,7 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
29
29
  context "Transport" do
30
30
  setup do
31
31
  @host, @port = ELASTICSEARCH_HOSTS.first.split(':')
32
+ @hosts = { hosts: [ { host: @host, port: @port } ] }
32
33
  begin; Object.send(:remove_const, :Patron); rescue NameError; end
33
34
  end
34
35
 
@@ -36,11 +37,10 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
36
37
  require 'typhoeus'
37
38
  require 'typhoeus/adapters/faraday'
38
39
 
39
- transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
40
- :hosts => [ { host: @host, port: @port } ] do |f|
41
- f.response :logger
42
- f.adapter :typhoeus
43
- end
40
+ transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new(@hosts) do |f|
41
+ f.response :logger
42
+ f.adapter :typhoeus
43
+ end
44
44
 
45
45
  client = Elasticsearch::Transport::Client.new transport: transport
46
46
  client.perform_request 'GET', ''
@@ -49,8 +49,7 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
49
49
  should "allow to customize the Faraday adapter to NetHttpPersistent" do
50
50
  require 'net/http/persistent'
51
51
 
52
- transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
53
- :hosts => [ { host: @host, port: @port } ] do |f|
52
+ transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new(@hosts) do |f|
54
53
  f.response :logger
55
54
  f.adapter :net_http_persistent
56
55
  end
@@ -60,13 +59,10 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
60
59
  end
61
60
 
62
61
  should "allow to define connection parameters and pass them" do
63
- transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
64
- :hosts => [ { host: @host, port: @port } ],
65
- :options => { :transport_options => {
66
- :params => { :format => 'yaml' }
67
- }
68
- }
69
-
62
+ transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new(
63
+ hosts: [ { host: @host, port: @port } ],
64
+ options: { transport_options: { params: { :format => 'yaml' } } }
65
+ )
70
66
  client = Elasticsearch::Transport::Client.new transport: transport
71
67
  response = client.perform_request 'GET', ''
72
68
 
@@ -76,24 +72,20 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
76
72
  should "use the Curb client" do
77
73
  require 'curb'
78
74
  require 'elasticsearch/transport/transport/http/curb'
79
-
80
- transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
81
- :hosts => [ { host: @host, port: @port } ] do |curl|
82
- curl.verbose = true
83
- end
75
+ transport = Elasticsearch::Transport::Transport::HTTP::Curb.new(@hosts) do |curl|
76
+ curl.verbose = true
77
+ end
84
78
 
85
79
  client = Elasticsearch::Transport::Client.new transport: transport
86
80
  client.perform_request 'GET', ''
87
- end unless JRUBY
81
+ end unless jruby?
88
82
 
89
83
  should "deserialize JSON responses in the Curb client" do
90
84
  require 'curb'
91
85
  require 'elasticsearch/transport/transport/http/curb'
92
-
93
- transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
94
- :hosts => [ { host: @host, port: @port } ] do |curl|
95
- curl.verbose = true
96
- end
86
+ transport = Elasticsearch::Transport::Transport::HTTP::Curb.new(@hosts) do |curl|
87
+ curl.verbose = true
88
+ end
97
89
 
98
90
  client = Elasticsearch::Transport::Client.new transport: transport
99
91
  response = client.perform_request 'GET', ''
@@ -101,7 +93,6 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
101
93
  assert_respond_to(response.body, :to_hash)
102
94
  assert_not_nil response.body['name']
103
95
  assert_equal 'application/json', response.headers['content-type']
104
- end unless JRUBY
96
+ end unless jruby?
105
97
  end
106
-
107
98
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.14.1.pre
4
+ version: 7.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -395,6 +395,7 @@ files:
395
395
  - spec/elasticsearch/transport/meta_header_spec.rb
396
396
  - spec/elasticsearch/transport/sniffer_spec.rb
397
397
  - spec/spec_helper.rb
398
+ - test/integration/jruby_test.rb
398
399
  - test/integration/transport_test.rb
399
400
  - test/profile/client_benchmark_test.rb
400
401
  - test/test_helper.rb
@@ -425,11 +426,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
425
426
  version: '2.4'
426
427
  required_rubygems_version: !ruby/object:Gem::Requirement
427
428
  requirements:
428
- - - ">"
429
+ - - ">="
429
430
  - !ruby/object:Gem::Version
430
- version: 1.3.1
431
+ version: '0'
431
432
  requirements: []
432
- rubygems_version: 3.1.6
433
+ rubygems_version: 3.2.22
433
434
  signing_key:
434
435
  specification_version: 4
435
436
  summary: Ruby client for Elasticsearch.
@@ -441,6 +442,7 @@ test_files:
441
442
  - spec/elasticsearch/transport/meta_header_spec.rb
442
443
  - spec/elasticsearch/transport/sniffer_spec.rb
443
444
  - spec/spec_helper.rb
445
+ - test/integration/jruby_test.rb
444
446
  - test/integration/transport_test.rb
445
447
  - test/profile/client_benchmark_test.rb
446
448
  - test/test_helper.rb