Skip to content

Instantly share code, notes, and snippets.

@joewilliams
Created August 25, 2009 20:47
Show Gist options
  • Save joewilliams/175001 to your computer and use it in GitHub Desktop.
Save joewilliams/175001 to your computer and use it in GitHub Desktop.
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