Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/reports/test_suite.rb')
-rw-r--r--lib/gitlab/ci/reports/test_suite.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/gitlab/ci/reports/test_suite.rb b/lib/gitlab/ci/reports/test_suite.rb
index cf43c5313c0..8bbf2e0f6cf 100644
--- a/lib/gitlab/ci/reports/test_suite.rb
+++ b/lib/gitlab/ci/reports/test_suite.rb
@@ -7,6 +7,7 @@ module Gitlab
attr_reader :name
attr_reader :test_cases
attr_reader :total_time
+ attr_reader :suite_error
def initialize(name = nil)
@name = name
@@ -25,12 +26,16 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def total_count
+ return 0 if suite_error
+
test_cases.values.sum(&:count)
end
# rubocop: enable CodeReuse/ActiveRecord
def total_status
- if failed_count > 0 || error_count > 0
+ if suite_error
+ TestCase::STATUS_ERROR
+ elsif failed_count > 0 || error_count > 0
TestCase::STATUS_FAILED
else
TestCase::STATUS_SUCCESS
@@ -49,14 +54,22 @@ module Gitlab
TestCase::STATUS_TYPES.each do |status_type|
define_method("#{status_type}") do
- test_cases[status_type] || {}
+ return {} if suite_error || test_cases[status_type].nil?
+
+ test_cases[status_type]
end
define_method("#{status_type}_count") do
- test_cases[status_type]&.length.to_i
+ return 0 if suite_error || test_cases[status_type].nil?
+
+ test_cases[status_type].length
end
end
+ def set_suite_error(msg)
+ @suite_error = msg
+ end
+
private
def existing_key?(test_case)