|
240 | 240 | end
|
241 | 241 | end
|
242 | 242 |
|
243 |
| - context 'when the adapter is specified' do |
244 |
| - |
| 243 | + context 'when the adapter is patron' do |
245 | 244 | let(:adapter) do
|
246 | 245 | client.transport.connections.all.first.connection.builder.adapter
|
247 | 246 | end
|
|
255 | 254 | end
|
256 | 255 | end
|
257 | 256 |
|
258 |
| - context 'when the adapter is specified as a string key' do |
| 257 | + context 'when the adapter is typhoeus' do |
| 258 | + let(:adapter) do |
| 259 | + client.transport.connections.all.first.connection.builder.adapter |
| 260 | + end |
| 261 | + |
| 262 | + let(:client) do |
| 263 | + described_class.new(adapter: :typhoeus) |
| 264 | + end |
| 265 | + |
| 266 | + it 'uses Faraday with the adapter' do |
| 267 | + expect(adapter).to eq Faraday::Adapter::Typhoeus |
| 268 | + end |
| 269 | + end |
259 | 270 |
|
| 271 | + context 'when the adapter is specified as a string key' do |
260 | 272 | let(:adapter) do
|
261 | 273 | client.transport.connections.all.first.connection.builder.adapter
|
262 | 274 | end
|
|
1629 | 1641 | expect(connections_after).to be >= (connections_before)
|
1630 | 1642 | end
|
1631 | 1643 | end
|
| 1644 | + |
| 1645 | + context 'when typhoeus is used as an adapter', unless: jruby? do |
| 1646 | + before do |
| 1647 | + require 'typhoeus' |
| 1648 | + end |
| 1649 | + |
| 1650 | + let(:options) do |
| 1651 | + { adapter: :typhoeus } |
| 1652 | + end |
| 1653 | + |
| 1654 | + let(:adapter) do |
| 1655 | + client.transport.connections.first.connection.builder.adapter |
| 1656 | + end |
| 1657 | + |
| 1658 | + it 'uses the patron connection handler' do |
| 1659 | + expect(adapter).to eq('Faraday::Adapter::Typhoeus') |
| 1660 | + end |
| 1661 | + |
| 1662 | + it 'keeps connections open' do |
| 1663 | + response = client.perform_request('GET', '_nodes/stats/http') |
| 1664 | + connections_before = response.body['nodes'].values.find { |n| n['name'] == node_names.first }['http']['total_opened'] |
| 1665 | + client.transport.reload_connections! |
| 1666 | + response = client.perform_request('GET', '_nodes/stats/http') |
| 1667 | + connections_after = response.body['nodes'].values.find { |n| n['name'] == node_names.first }['http']['total_opened'] |
| 1668 | + expect(connections_after).to be >= (connections_before) |
| 1669 | + end |
| 1670 | + end |
1632 | 1671 | end
|
1633 | 1672 | end
|
1634 | 1673 | end
|
0 commit comments