Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature different branches #18

Merged
merged 2 commits into from Jan 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion abt_worker.rb
Expand Up @@ -43,7 +43,9 @@
puts "Merged config:#{config.inspect}"
raise "No git url found!" unless config['git_url']
puts "cloning #{config['git_url']}..."
Git.clone(config['git_url'], clone_dir, :path => '.')
g = Git.clone(config['git_url'], clone_dir, :path => '.')
branch = config.fetch('git_branch', 'master')
g.checkout(branch)
old_specs = nil
test_gemfile = File.join(File.expand_path(clone_dir+'/test'), 'Gemfile')
root_gemfile = File.join(File.expand_path(clone_dir), 'Gemfile')
Expand Down
21 changes: 14 additions & 7 deletions notifiers/hip_chat_notifier.rb
Expand Up @@ -2,6 +2,8 @@ class HipChatNotifier
IronWorker.config.merge_gem 'hipchat-api' if defined? IronWorker
require 'hipchat-api'

MAX_HIPCHAT_MSG_LENGTH = 10000

def initialize(config)
@client = HipChat::API.new(config["token"])
@room_name = config["room_name"]
Expand All @@ -15,20 +17,25 @@ def send_formatted_message(params)
result = params[:result]
color = result.passed? ? 'green' : 'red'
message = "Result: <b>#{result.status}</b> [#{result.pass_percentage}%] (#{params[:elapsed_time]} sec)<br>
<strong>#{result.run_count}</strong> tests, <strong>#{result.assertion_count}</strong> assertions"
<strong>#{result.run_count}</strong> tests, <strong>#{result.assertion_count}</strong> assertions, <strong>#{result.faults.size}</strong> faults"
important_room_failure_message = message
message+="<br/><b>Tests benchmarks</b>: <br/>" + format_benchmarks(params[:test_benchmarks]) if params[:test_benchmarks]

if result.error_occurred? || result.failure_occurred?
message+=", <strong>#{result.failure_count}</strong> failures, <strong>#{result.error_count}</strong>, errors<br/>"
result.faults.each { |f| message+="<br><pre>#{add_github_urls(f.to_s.gsub(/>/, ' ').gsub(/</, ' '))}</pre><br/>" }
end
message+="<br/>URL: <b>#{@git_url}</b> "
message+="<br/>HUD (log): <a href='#{hud_log_url(@iw_details)}'>#{@iw_details[:task_id]}</a> " if @iw_details
git_url = "<br/>URL: <b>#{@git_url}</b> "
message += git_url
important_room_failure_message += git_url

important_room_failure_message = "Result: <b>#{result.status}</b> [#{result.pass_percentage}%] (#{params[:elapsed_time]} sec)<br>
<strong>#{result.run_count}</strong> tests, <strong>#{result.assertion_count}</strong> assertions"
important_room_failure_message += "<br/>URL: <b>#{@git_url}</b> "
important_room_failure_message += "<br/>HUD (log): <a href='#{hud_log_url(@iw_details)}'>#{@iw_details[:task_id]}</a> " if @iw_details
hud_url = "<br/>HUD (log): <a href='#{hud_log_url(@iw_details)}'>#{@iw_details[:task_id]}</a> " if @iw_details
message += hud_url
important_room_failure_message += hud_url

if message.size() > MAX_HIPCHAT_MSG_LENGTH
message = important_room_failure_message
end
send_message(@room_name, message, color)
send_message(@important_room_name, important_room_failure_message, color,true) unless result.passed?
end
Expand Down