test/integration/transport_test.rb in elasticsearch-transport-6.1.0 vs test/integration/transport_test.rb in elasticsearch-transport-6.2.0
- old
+ new
@@ -9,31 +9,31 @@
Elasticsearch::Extensions::Test::Cluster.stop(number_of_nodes: 2) if ENV['SERVER'] and Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 2)
end
context "Transport" do
setup do
- @port = (ENV['TEST_CLUSTER_PORT'] || 9250).to_i
+ @host, @port = ELASTICSEARCH_HOSTS.first.split(':')
begin; Object.send(:remove_const, :Patron); rescue NameError; end
end
should "allow to customize the Faraday adapter" do
require 'typhoeus'
require 'typhoeus/adapters/faraday'
transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
- :hosts => [ { :host => 'localhost', :port => @port } ] do |f|
+ :hosts => [ { host: @host, port: @port } ] do |f|
f.response :logger
f.adapter :typhoeus
end
client = Elasticsearch::Transport::Client.new transport: transport
client.perform_request 'GET', ''
end
should "allow to define connection parameters and pass them" do
transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
- :hosts => [ { :host => 'localhost', :port => @port } ],
+ :hosts => [ { host: @host, port: @port } ],
:options => { :transport_options => {
:params => { :format => 'yaml' }
}
}
@@ -46,11 +46,11 @@
should "use the Curb client" do
require 'curb'
require 'elasticsearch/transport/transport/http/curb'
transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
- :hosts => [ { :host => 'localhost', :port => @port } ] do |curl|
+ :hosts => [ { host: @host, port: @port } ] do |curl|
curl.verbose = true
end
client = Elasticsearch::Transport::Client.new transport: transport
client.perform_request 'GET', ''
@@ -59,10 +59,10 @@
should "deserialize JSON responses in the Curb client" do
require 'curb'
require 'elasticsearch/transport/transport/http/curb'
transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
- :hosts => [ { :host => 'localhost', :port => @port } ] do |curl|
+ :hosts => [ { host: @host, port: @port } ] do |curl|
curl.verbose = true
end
client = Elasticsearch::Transport::Client.new transport: transport
response = client.perform_request 'GET', ''