Sha256: c68bc8531b1499ad79734ad7bcc579a1bfdb4aa4ea9cfcd554322998006c81a1
Contents?: true
Size: 834 Bytes
Versions: 2
Compression:
Stored size: 834 Bytes
Contents
module TestHelperMethods def keep_alive_test(client,&get_status_blk) responses = [] start = Time.now 50.times.each do c = client.dup # want a new client everytime responses.push get_status_blk.call(c) end normal = Time.now - start # we want a whole new pool to make sure we don't cheat connection_pool = HotTub::Session.new( :client => client) start = Time.now 50.times.each do #responses.push get_status_blk.call(connection_pool.get) connection_pool.run do |c| responses.push get_status_blk.call(c) end end keep_alive = Time.now - start puts "#{client.class.name} keep-alive: #{keep_alive}; normal: #{normal};" #puts responses.join(", ") (keep_alive < normal).should be_true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hot_tub-0.0.2 | spec/test_helper_methods.rb |
hot_tub-0.0.1 | spec/test_helper_methods.rb |