Class: CemAcpt::TestRunner::LogFormatter::BoltSummaryResultsFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb

Overview

Formats the results of a Bolt::SummaryResults object

Constant Summary

Constants inherited from Base

CemAcpt::TestRunner::LogFormatter::Base::INDENT

Instance Attribute Summary

Attributes inherited from Base

#subject

Instance Method Summary collapse

Methods inherited from Base

#inspect, #to_s

Constructor Details

#initialize(config, instance_names_ips, subject: nil) ⇒ BoltSummaryResultsFormatter

Returns a new instance of BoltSummaryResultsFormatter.



11
12
13
14
15
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb', line 11

def initialize(config, instance_names_ips, subject: nil)
  super(subject)
  @config = config
  @instance_names_ips = instance_names_ips
end

Instance Method Details

#host_name(response = nil) ⇒ Object



34
35
36
37
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb', line 34

def host_name(response = nil)
  super(response)
  log_subject.items.map { |i| name_from_ip(i.target) }.compact.uniq.join(', ')
end

#results(response = nil) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb', line 25

def results(response = nil)
  super(response)
  log_subject.each_with_object([]) do |res, ary|
    res.results.each do |r|
      ary << (r.error? ? format_error_result(r) : format_result(r))
    end
  end
end

#summary(response = nil) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb', line 17

def summary(response = nil)
  super(response)
  [
    "SUMMARY: #{test_name(log_subject)}:",
    normalize_whitespace(log_subject.summary),
  ].join(' ')
end

#test_name(response = nil) ⇒ Object



39
40
41
42
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb', line 39

def test_name(response = nil)
  super(response)
  'Bolt tests'
end