Sha256: af78f1bddd5f3e8950fd42ddeeecc00f824e78db0553ef04ffb4171b4d89331a

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Hayabusa" do
  it "two simultanious request should be handeled by the same process - one should proxy the request" do
    require "rubygems"
    require "http2"
    require "json"
    
    Http2.new(:host => "localhost") do |http1|
      Http2.new(:host => "localhost") do |http2|
        res1 = nil
        res2 = nil
        
        t1 = Thread.new do
          res1 = http1.get(:url => "hayabusa_fcgi_test/sleeper.rhtml")
        end
        
        t2 = Thread.new do
          res2 = http2.get(:url => "hayabusa_fcgi_test/sleeper.rhtml")
        end
        
        t1.join
        t2.join
        
        pid1 = res1.body.to_i
        pid2 = res2.body.to_i
        
        raise "Expected PIDs to be the same: '#{res1.body}', '#{res2.body}'." if pid1 != pid2 or pid1 == 0 or pid2 == 0
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hayabusa-0.0.5 spec/fcgi_multiple_processes_spec.rb
hayabusa-0.0.4 spec/fcgi_multiple_processes_spec.rb
hayabusa-0.0.3 spec/fcgi_multiple_processes_spec.rb
hayabusa-0.0.2 spec/fcgi_multiple_processes_spec.rb
hayabusa-0.0.1 spec/fcgi_multiple_processes_spec.rb