Skip to content

Instantly share code, notes, and snippets.

@kazjote
Created March 8, 2013 17:05
Show Gist options
  • Save kazjote/5118020 to your computer and use it in GitHub Desktop.
Save kazjote/5118020 to your computer and use it in GitHub Desktop.
require 'httparty'
Array.new(32) {|i| i}.map do |worker|
fork do
file = File.open("worker_#{worker}.log", "w")
1000.times do |i|
url = "http://localhost:9290/tests/test1.txt"
page = HTTParty.get(url)
file.puts("==============")
file.puts("url: #{url}")
file.puts ""
file.puts page.code
file.puts page.body
unless page.body.include?(%Q{test1})
puts "ERROR"
file.puts "ERROR! body empty?!"
end
end
file.close
end
end
Array.new(32) do
fork do
1000.times do
HTTParty.get("http://localhost:9290/tests/test2")
end
end
end
Process.waitall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment