Class: Gitlab::Ci::Reports::TestSuiteComparer

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/reports/test_suite_comparer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(name, base_suite, head_suite) ⇒ TestSuiteComparer

Returns a new instance of TestSuiteComparer.


11
12
13
14
15
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 11

def initialize(name, base_suite, head_suite)
  @name = name
  @base_suite = base_suite || TestSuite.new
  @head_suite = head_suite
end

Instance Attribute Details

#base_suiteObject (readonly)

Returns the value of attribute base_suite


9
10
11
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 9

def base_suite
  @base_suite
end

#head_suiteObject (readonly)

Returns the value of attribute head_suite


9
10
11
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 9

def head_suite
  @head_suite
end

#nameObject (readonly)

Returns the value of attribute name


9
10
11
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 9

def name
  @name
end

Instance Method Details

#error_countObject


81
82
83
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 81

def error_count
  new_errors.count + existing_errors.count
end

#existing_errorsObject


49
50
51
52
53
54
55
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 49

def existing_errors
  strong_memoize(:existing_errors) do
    head_suite.error.select do |key, _|
      base_suite.error.include?(key)
    end.values
  end
end

#existing_failuresObject


25
26
27
28
29
30
31
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 25

def existing_failures
  strong_memoize(:existing_failures) do
    head_suite.failed.select do |key, _|
      base_suite.failed.include?(key)
    end.values
  end
end

#failed_countObject


77
78
79
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 77

def failed_count
  new_failures.count + existing_failures.count
end

#new_errorsObject


41
42
43
44
45
46
47
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 41

def new_errors
  strong_memoize(:new_errors) do
    head_suite.error.reject do |key, _|
      base_suite.error.include?(key)
    end.values
  end
end

#new_failuresObject


17
18
19
20
21
22
23
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 17

def new_failures
  strong_memoize(:new_failures) do
    head_suite.failed.reject do |key, _|
      base_suite.failed.include?(key)
    end.values
  end
end

#resolved_countObject


73
74
75
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 73

def resolved_count
  resolved_failures.count + resolved_errors.count
end

#resolved_errorsObject


57
58
59
60
61
62
63
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 57

def resolved_errors
  strong_memoize(:resolved_errors) do
    head_suite.success.select do |key, _|
      base_suite.error.include?(key)
    end.values
  end
end

#resolved_failuresObject


33
34
35
36
37
38
39
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 33

def resolved_failures
  strong_memoize(:resolved_failures) do
    head_suite.success.select do |key, _|
      base_suite.failed.include?(key)
    end.values
  end
end

#total_countObject


65
66
67
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 65

def total_count
  head_suite.total_count
end

#total_statusObject


69
70
71
# File 'lib/gitlab/ci/reports/test_suite_comparer.rb', line 69

def total_status
  head_suite.total_status
end