Class: Res::Reporters::Hive

Inherits:
Object
  • Object
show all
Defined in:
lib/res/reporters/hive.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Hive

Returns a new instance of Hive.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/res/reporters/hive.rb', line 8

def initialize( args = {} )

  if args[:url]
    ::Hive::Messages.configure do |config|
      config.base_path       = args[:url]
      config.pem_file        = args[:cert]
      config.ssl_verify_mode = args[:ssl_verify_mode]
    end
  end

end

Instance Method Details

#submit_results(ir, args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/res/reporters/hive.rb', line 20

def submit_results(ir, args)
  
  passed  = ir.count(:passed)
  failed  = ir.count(:failed)
  running = ir.count(:running)
  errored = ir.tests.count - passed - failed - running
  
  # Still include count summaries for backward compatability
  params = { :failed_count => failed, 
             :passed_count => passed, 
             :errored_count => errored, 
             :running_count => running,
             :result_details => ir.flat_format.to_json }
  
  hive_job = ::Hive::Messages::Job.new(:job_id => args[:job_id])
  begin
    update_response = hive_job.update_results(params)
    #log "Hive results update response: #{update_response}"
  rescue
    #log "Hive::Messages couldn't hit the hive, retrying once more"
    update_response = hive_job.update_results(params)
    #log "Hive results update response: #{update_response}"
  end
end