Class: Gitlab::Ci::Reports::TestReport
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::TestReport
- Defined in:
- lib/gitlab/ci/reports/test_report.rb
Instance Attribute Summary collapse
-
#test_suites ⇒ Object
readonly
Returns the value of attribute test_suites.
Instance Method Summary collapse
- #get_suite(suite_name) ⇒ Object
-
#initialize ⇒ TestReport
constructor
A new instance of TestReport.
- #suite_errors ⇒ Object
-
#total_count ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
-
#total_status ⇒ Object
rubocop: enable CodeReuse/ActiveRecord.
-
#total_time ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
- #with_attachment! ⇒ Object
Constructor Details
#initialize ⇒ TestReport
Returns a new instance of TestReport.
9 10 11 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 9 def initialize @test_suites = {} end |
Instance Attribute Details
#test_suites ⇒ Object (readonly)
Returns the value of attribute test_suites.
7 8 9 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 7 def test_suites @test_suites end |
Instance Method Details
#get_suite(suite_name) ⇒ Object
13 14 15 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 13 def get_suite(suite_name) test_suites[suite_name] ||= TestSuite.new(suite_name) end |
#suite_errors ⇒ Object
45 46 47 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 45 def suite_errors test_suites.transform_values(&:suite_error).compact end |
#total_count ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
24 25 26 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 24 def total_count test_suites.values.sum(&:total_count) end |
#total_status ⇒ Object
rubocop: enable CodeReuse/ActiveRecord
29 30 31 32 33 34 35 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 29 def total_status if failed_count > 0 || error_count > 0 TestCase::STATUS_FAILED else TestCase::STATUS_SUCCESS end end |
#total_time ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
18 19 20 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 18 def total_time test_suites.values.sum(&:total_time) end |
#with_attachment! ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 37 def @test_suites.keep_if do |_job_name, test_suite| test_suite..present? end self end |