Skip to content

Instantly share code, notes, and snippets.

@jdunphy
Created August 14, 2009 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdunphy/168109 to your computer and use it in GitHub Desktop.
Save jdunphy/168109 to your computer and use it in GitHub Desktop.
require 'benchmark'
require 'rubygems'
require 'gruff'
require 'httparty'
require 'json'
class LoggedRequest
attr_reader :response_time, :path, :status
def initialize(request)
if request =~ /\"[A-Z]{3,4}\ (.+)\ HTTP/
@path = $1
end
if request =~ /\" ([2345]\d{2})/
@status = $1.to_i
end
if request =~ /[0-9\.]+\Z/
@response_time = $~[0].to_f
end
end
end
class Base
include HTTParty
base_uri 'localhost:7000'
end
class Fast5
include HTTParty
base_uri 'localhost:8000'
end
path = ARGV.shift
f = File.new(path)
i = 0
fails = []
f.each_line do |l|
r = LoggedRequest.new(l)
puts i
base = JSON.parse(Base.get(r.path))
fast5 = JSON.parse(Fast5.get(r.path))
if base != fast5
fails << [r.path, base, fast5]
end
i += 1
break if i > 300
end
puts "How many fails? #{fails.length}"
fails.each do |f|
puts f[0]
puts f[1]
puts f[2]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment