Skip to content

Commit 9f0c5c8

Browse files
committed
[Tests] Refactors initialization of the client for YAML test runner
1 parent 7356210 commit 9f0c5c8

File tree

1 file changed

+5
-10
lines changed
  • elasticsearch-api/spec/yaml-test-runner

1 file changed

+5
-10
lines changed

elasticsearch-api/spec/yaml-test-runner/run.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,13 @@
4949
transport_options = {}
5050
end
5151

52-
CLIENT = if ENV['ES_API_KEY']
53-
Elasticsearch::Client.new(host: host, api_key: ENV['ES_API_KEY'], transport_options: transport_options)
54-
else
55-
Elasticsearch::Client.new(host: host, transport_options: transport_options)
56-
end
52+
options = { host: host, transport_options: transport_options, compression: true }
53+
options.merge!({ api_key: ENV['ES_API_KEY'] }) if ENV['ES_API_KEY']
54+
CLIENT = Elasticsearch::Client.new(options)
5755

5856
tests_path = File.expand_path('./tmp', __dir__)
59-
ruby_version = if defined? JRUBY_VERSION
60-
"jruby-#{JRUBY_VERSION}"
61-
else
62-
"ruby-#{RUBY_VERSION}"
63-
end
57+
ruby_version = defined?(JRUBY_VERSION) ? "jruby-#{JRUBY_VERSION}" : "ruby-#{RUBY_VERSION}"
58+
6459
log_filename = "es-#{Elasticsearch::VERSION}-transport-#{ENV['TRANSPORT_VERSION']}-#{ruby_version}.log"
6560
logfile = File.expand_path "../../tmp/#{log_filename}", __dir__
6661
logger = Logger.new(File.open(logfile, 'w'))

0 commit comments

Comments
 (0)