Created
August 25, 2009 20:47
-
-
Save joewilliams/175001 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 'rest_client' | |
| urls = ["http://localhost:5984/"] | |
| databases = ["testdb1"] | |
| count = 10 | |
| inital_value = "test" | |
| field_name = "test" | |
| for i in (1..count) | |
| url = urls[rand(urls.length - 1)] | |
| database = databases[rand(databases.length - 1)] | |
| puts "Doc Count: #{i}" | |
| puts "Database URL: #{url}#{database}" | |
| begin | |
| result = RestClient.post("#{url}/#{database}/", | |
| "{\"#{field_name}\": \"#{inital_value}\"}", | |
| :content_type => "application/json") | |
| puts "Result: #{result}" | |
| rescue | |
| puts "Conflict! Skipping ..." | |
| end | |
| puts "#########################################################################" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment