Sha256: 3c4685bfb8fb916405fea9a2676607f88ab7d8c432afed233e1e65fb92c3aa8f

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

# An example of handing tons of nasty URLs to Rails to see what it does.
require 'rubygems'
require 'rfuzz/session'
require 'thread'

$io_death_count = 7
threads = []

include RFuzz

if ARGV.length != 3
  puts "usage: ruby random_sockets.rb <runs> <threads> <uri>"
end

s = Session.new :host => "127.0.0.1", :port => 3000
s.run 10, :save_as => ["runs.csv","counts.csv"] do |c,r|

  ARGV[0].to_i.times do
    ARGV[1].to_i.times do |u|
      t = Thread.new do
        s.count_errors(:legal) do
          resp = c.get(ARGV[2])
          s.count resp.http_status
        end
      end

      t.abort_on_exception = true
      threads << t
    end

    threads.each {|t| t.join }

    threads = []
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rfuzz-0.9 examples/random_sockets.rb