spec/elasticsearch/transport/base_spec.rb in elasticsearch-transport-7.7.0 vs spec/elasticsearch/transport/base_spec.rb in elasticsearch-transport-7.8.0.pre
- old
+ new
@@ -1,8 +1,21 @@
-# Licensed to Elasticsearch B.V under one or more agreements.
-# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
-# See the LICENSE file in the project root for more information
+# Licensed to Elasticsearch B.V. under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Elasticsearch B.V. licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
require 'spec_helper'
describe Elasticsearch::Transport::Transport::Base do
context 'when a host is printed in a logged message' do
@@ -94,11 +107,10 @@
retry_on_failure: 2
}
end
context 'when `perform_request` is called without a `retry_on_failure` option value' do
-
before do
expect(client.transport).to receive(:get_connection).exactly(3).times.and_call_original
end
it 'uses the client `retry_on_failure` value' do
@@ -107,11 +119,10 @@
}.to raise_exception(Faraday::ConnectionFailed)
end
end
context 'when `perform_request` is called with a `retry_on_failure` option value' do
-
before do
expect(client.transport).to receive(:get_connection).exactly(6).times.and_call_original
end
it 'uses the option `retry_on_failure` value' do
@@ -121,11 +132,10 @@
end
end
end
context 'when the client has `retry_on_failure` set to true' do
-
let(:client) do
Elasticsearch::Transport::Client.new(arguments)
end
let(:arguments) do
@@ -134,11 +144,10 @@
retry_on_failure: true
}
end
context 'when `perform_request` is called without a `retry_on_failure` option value' do
-
before do
expect(client.transport).to receive(:get_connection).exactly(4).times.and_call_original
end
it 'uses the default `MAX_RETRIES` value' do
@@ -147,11 +156,10 @@
}.to raise_exception(Faraday::ConnectionFailed)
end
end
context 'when `perform_request` is called with a `retry_on_failure` option value' do
-
before do
expect(client.transport).to receive(:get_connection).exactly(6).times.and_call_original
end
it 'uses the option `retry_on_failure` value' do
@@ -161,11 +169,10 @@
end
end
end
context 'when the client has `retry_on_failure` set to false' do
-
let(:client) do
Elasticsearch::Transport::Client.new(arguments)
end
let(:arguments) do
@@ -174,10 +181,9 @@
retry_on_failure: false
}
end
context 'when `perform_request` is called without a `retry_on_failure` option value' do
-
before do
expect(client.transport).to receive(:get_connection).once.and_call_original
end
it 'does not retry' do