Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 1.32 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'yaml'
  2. require 'time'
  3. require 'iron_worker'
  4. require 'abt'
  5.  
  6. # Let's load up our config file containing our Iron.io credentials and whatever else the tests will need to run
  7. @config = YAML::load_file('config.yml')
  8.  
  9. # Now configure IronWorker so we can run a and schedule AbtWorker
  10. IronWorker.configure do |config|
  11.   config.token = @config['iron']['token']
  12.   config.project_id = @config['iron']['project_id']
  13. end
  14.  
  15. # Now we'll setup the config we want to pass to the library we'll be testing.
  16. # For this example we'll be running the IronMQ test suite, but this can be any library.
  17. @iron_mq_config = {:iron_mq=>{:token=>@config['iron']['token'],
  18. :project_id=>@config['iron']['project_id']}}
  19.  
  20. # Create the AbtWorker
  21. worker = Abt::AbtWorker.new
  22. # Set the git url of the library we want to test
  23. worker.git_url = "git://github.com/iron-io/iron_mq_ruby.git"
  24. # Set the config hash
  25. worker.test_config = @iron_mq_config
  26. # Add any notifiers we want
  27. worker.add_notifier(:hip_chat_notifier, :config=>{"token"=>@config['hipchat']['token'],
  28.     "room_name"=>@config['hipchat']['room']})
  29. # Then queue it up!
  30. worker.queue
  31. # Wait for it to finish and check the log
  32. status = worker.wait_until_complete
  33. p status
  34. puts "LOG:"
  35. puts worker.get_log
  36.  
  37. # When it's working, schedule it to run every half hour
  38. # worker.schedule(:start_at=>Time.now.iso8601, :run_every=>60*30)