Skip to content

Instantly share code, notes, and snippets.

@treeder
Created February 7, 2012 10:12
Show Gist options
  • Save treeder/1758935 to your computer and use it in GitHub Desktop.
Save treeder/1758935 to your computer and use it in GitHub Desktop.
if defined? $abt_config
@config = $abt_config
return @config
end
require 'yaml'
require 'time'
require 'iron_worker'
require 'abt'
# Let's load up our config file containing our Iron.io credentials and whatever else the tests will need to run
@config = YAML::load_file('config.yml')
# Now configure IronWorker so we can run a and schedule AbtWorker
IronWorker.configure do |config|
config.token = @config['iron']['token']
config.project_id = @config['iron']['project_id']
end
# Now we'll setup the config we want to pass to the library we'll be testing.
# For this example we'll be running the IronMQ test suite, but this can be any library.
@iron_mq_config = {:iron_mq=>{:token=>@config['iron']['token'],
:project_id=>@config['iron']['project_id']}}
# Create the AbtWorker
worker = Abt::AbtWorker.new
# Set the git url of the library we want to test
worker.git_url = "git://github.com/iron-io/iron_mq_ruby.git"
# Set the config hash
worker.test_config = @iron_mq_config
# Add any notifiers we want
worker.add_notifier(:hip_chat_notifier, :config=>{"token"=>@config['hipchat']['token'],
"room_name"=>@config['hipchat']['room']})
# Then queue it up!
worker.queue
# Wait for it to finish and check the log
status = worker.wait_until_complete
p status
puts "LOG:"
puts worker.get_log
# When it's working, schedule it to run every half hour
# worker.schedule(:start_at=>Time.now.iso8601, :run_every=>60*30)
worker.schedule(:start_at=>Time.now.iso8601, :run_every=>60*30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment