Skip to content

Instantly share code, notes, and snippets.

@tobias
Created November 30, 2010 21:56
Show Gist options
  • Select an option

  • Save tobias/722497 to your computer and use it in GitHub Desktop.

Select an option

Save tobias/722497 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'restclient'
require 'nokogiri'
drivers = %w{ ec2 mock rackspace gogrid terremark }
threads = []
#dc_endpoint = "http://localhost:8080/deltacloud/api"
dc_endpoint = "http://localhost:3001/api"
20.times do
threads << Thread.new do
100.times do
driver = drivers[rand(drivers.size)]
sleep rand
puts "requesting #{driver}..."
result = RestClient.get dc_endpoint, :headers => [ "X-Deltacloud-Driver:#{driver}" ]
doc = Nokogiri::XML(result)
remote_driver = doc.xpath('/api').first['driver']
out = " >>> sent: #{driver} got: #{remote_driver}"
out << ' BOOM' unless driver == remote_driver
puts out
end
end
end
puts "Joining threads..."
threads.each &:join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment