Created
November 30, 2010 21:56
-
-
Save tobias/722497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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