Skip to content

Commit

Permalink
+ speed test
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Mar 18, 2011
1 parent af0ceeb commit dc124a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion integration
Expand Up @@ -7,9 +7,12 @@ def each_type
yield :live, 0
end

def ask_server query
`curl -S 'localhost:8080/books?query=#{query}&ids=20'`
end
def server query, match
@tests += 1
if `curl -S 'localhost:8080/books?query=#{query}&ids=20'`.chomp.include?(match)
if ask_server(query).chomp.include?(match)
puts "Yay, server returned #{match} for #{query}!"
else
fail "#{query} result does not include #{match}"
Expand Down Expand Up @@ -75,6 +78,12 @@ begin
system "open -a 'Google Chrome' http://localhost:3210/?q=a%2A%20b"
sleep 5

puts "Now for a speed test"
queries = ['alan', 'pinchn~', 'sp', 'title:lyterature~+2002'].cycle
100.times do
ask_server queries.next
end

puts
puts "SUCCESS! #{@tests} tests run without a hitch :)"
puts
Expand Down

0 comments on commit dc124a0

Please sign in to comment.