Class: Datadog::CI::TestSuite
Overview
Instance Attribute Summary
Attributes inherited from Span
#tracer_span
Instance Method Summary
collapse
#get_tag, #set_metric, #set_tag, #set_tags, #synchronize
Methods inherited from Span
#base_commit_sha, #clear_tag, #failed!, #failed?, #get_metric, #get_tag, #git_branch, #git_commit_message, #git_commit_sha, #git_repository_url, #git_tag, #id, #name, #original_git_commit_message, #original_git_commit_sha, #os_architecture, #os_platform, #os_version, #passed!, #passed?, #runtime_name, #runtime_version, #service, #set_default_tags, #set_environment_runtime_tags, #set_metric, #set_tag, #set_tags, #skipped!, #skipped?, #source_file, #status, #to_s, #trace_id, #type, #undefined?
Constructor Details
#initialize(tracer_span) ⇒ TestSuite
Returns a new instance of TestSuite.
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/datadog/ci/test_suite.rb', line 16
def initialize(tracer_span)
super
@execution_stats_per_test = {}
@final_statuses_per_test = {}
end
|
Instance Method Details
#all_executions_failed?(test_id) ⇒ Boolean
74
75
76
77
78
79
|
# File 'lib/datadog/ci/test_suite.rb', line 74
def all_executions_failed?(test_id)
synchronize do
stats = @execution_stats_per_test[test_id]
stats && stats[Ext::Test::Status::FAIL] > 0 && stats[Ext::Test::Status::PASS] == 0
end
end
|
#all_executions_passed?(test_id) ⇒ Boolean
82
83
84
85
86
87
|
# File 'lib/datadog/ci/test_suite.rb', line 82
def all_executions_passed?(test_id)
synchronize do
stats = @execution_stats_per_test[test_id]
stats && stats[Ext::Test::Status::PASS] > 0 && stats[Ext::Test::Status::FAIL] == 0
end
end
|
#any_passed? ⇒ Boolean
57
58
59
60
61
62
63
|
# File 'lib/datadog/ci/test_suite.rb', line 57
def any_passed?
synchronize do
@execution_stats_per_test.any? do |_, stats|
stats[Ext::Test::Status::PASS] > 0
end
end
end
|
#any_test_retry_passed?(test_id) ⇒ Boolean
66
67
68
69
70
71
|
# File 'lib/datadog/ci/test_suite.rb', line 66
def any_test_retry_passed?(test_id)
synchronize do
stats = @execution_stats_per_test[test_id]
stats && stats[Ext::Test::Status::PASS] > 0
end
end
|
#expected_test_done!(test_name) ⇒ Object
106
107
108
109
110
111
112
|
# File 'lib/datadog/ci/test_suite.rb', line 106
def expected_test_done!(test_name)
synchronize do
@expected_tests_set.delete(test_name)
finish if @expected_tests_set.empty?
end
end
|
#finish ⇒ void
This method returns an undefined value.
Finishes this test suite.
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/datadog/ci/test_suite.rb', line 30
def finish
synchronize do
set_status_from_stats! if undefined?
test_visibility.deactivate_test_suite(name)
super
end
end
|
#record_test_final_status(test_id, final_status) ⇒ Object
50
51
52
53
54
|
# File 'lib/datadog/ci/test_suite.rb', line 50
def record_test_final_status(test_id, final_status)
synchronize do
@final_statuses_per_test[test_id] = final_status
end
end
|
#record_test_result(test_id, datadog_test_status) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/datadog/ci/test_suite.rb', line 42
def record_test_result(test_id, datadog_test_status)
synchronize do
@execution_stats_per_test[test_id] ||= Hash.new(0)
@execution_stats_per_test[test_id][datadog_test_status] += 1
end
end
|
#set_expected_tests!(expected_tests) ⇒ Object
97
98
99
100
101
102
103
|
# File 'lib/datadog/ci/test_suite.rb', line 97
def set_expected_tests!(expected_tests)
synchronize do
return if @expected_tests_set
@expected_tests_set = Set.new(expected_tests)
end
end
|
#test_executed?(test_id) ⇒ Boolean
90
91
92
93
94
|
# File 'lib/datadog/ci/test_suite.rb', line 90
def test_executed?(test_id)
synchronize do
@execution_stats_per_test.key?(test_id)
end
end
|