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
16
17
18
19
20
21
22
|
# File 'lib/datadog/ci/test_suite.rb', line 16
def initialize(tracer_span)
super
@execution_stats_per_test = {}
end
|
Instance Method Details
#all_executions_failed?(test_id) ⇒ Boolean
#all_executions_passed?(test_id) ⇒ Boolean
#any_passed? ⇒ Boolean
46
47
48
49
50
51
52
|
# File 'lib/datadog/ci/test_suite.rb', line 46
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
55
56
57
58
59
60
|
# File 'lib/datadog/ci/test_suite.rb', line 55
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
97
98
99
100
101
102
103
|
# File 'lib/datadog/ci/test_suite.rb', line 97
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.
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/datadog/ci/test_suite.rb', line 26
def finish
synchronize do
set_status_from_stats! if undefined?
test_visibility.deactivate_test_suite(name)
super
end
end
|
#record_test_result(test_id, datadog_test_status) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/datadog/ci/test_suite.rb', line 38
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
88
89
90
91
92
93
94
|
# File 'lib/datadog/ci/test_suite.rb', line 88
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
81
82
83
84
85
|
# File 'lib/datadog/ci/test_suite.rb', line 81
def test_executed?(test_id)
synchronize do
@execution_stats_per_test.key?(test_id)
end
end
|