File: pipeline_tests.rb

package info (click to toggle)
ruby-excon 0.112.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,232 kB
  • sloc: ruby: 7,855; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Shindo.tests('Pipelined Requests') do
  with_server('good_ipv4') do

    tests('with default :persistent => true') do
      returns(%w{ 1 2 3 4 }, 'connection is persistent') do
        connection = Excon.new('http://127.0.0.1:9292', :persistent => true)

        ret = []
        ret << connection.requests([
          {:method => :get, :path => '/echo/request_count'},
          {:method => :get, :path => '/echo/request_count'}
        ]).map(&:body)
        ret << connection.requests([
          {:method => :get, :path => '/echo/request_count'},
          {:method => :get, :path => '/echo/request_count'}
        ]).map(&:body)
        ret.flatten
      end
    end

    tests('with default :persistent => false') do
      returns(%w{ 1 2 1 2 }, 'connection is persistent per call to #requests') do
        connection = Excon.new('http://127.0.0.1:9292', :persistent => false)

        ret = []
        ret << connection.requests([
          {:method => :get, :path => '/echo/request_count'},
          {:method => :get, :path => '/echo/request_count'}
        ]).map(&:body)
        ret << connection.requests([
          {:method => :get, :path => '/echo/request_count'},
          {:method => :get, :path => '/echo/request_count'}
        ]).map(&:body)
        ret.flatten
      end

    end

  end
end