Class: Datadog::CI::TestSession
- Inherits:
-
ConcurrentSpan
- Object
- Span
- ConcurrentSpan
- Datadog::CI::TestSession
- Defined in:
- lib/datadog/ci/test_session.rb
Overview
Represents the whole test session process. Documentation on test sessions is here: https://docs.datadoghq.com/continuous_integration/explorer/?tab=testruns#sessions This object can be shared between multiple threads.
Instance Attribute Summary collapse
-
#total_tests_count ⇒ Object
Returns the value of attribute total_tests_count.
Attributes inherited from Span
Instance Method Summary collapse
-
#ci_job_name ⇒ String
Return the test session's CI job name (e.g. "build", "test", etc.).
-
#ci_provider ⇒ String
Return the test session's CI provider name (e.g. "travis", "circleci", etc.).
- #code_coverage? ⇒ Boolean
-
#finish ⇒ void
Finishes the current test session.
-
#inheritable_tags ⇒ Hash
Return the test session tags that could be inherited by sub-spans.
-
#name ⇒ String
Return the test session's name which is equal to test command used.
- #skipping_tests? ⇒ Boolean
-
#test_command ⇒ String
Return the test session's command used to run the tests.
Methods inherited from ConcurrentSpan
#get_tag, #initialize, #set_metric, #set_tag, #set_tags, #synchronize
Methods inherited from Span
#clear_tag, #failed!, #failed?, #get_metric, #get_tag, #git_branch, #git_commit_sha, #git_repository_url, #id, #initialize, #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, #to_s, #trace_id, #type, #undefined?
Constructor Details
This class inherits a constructor from Datadog::CI::ConcurrentSpan
Instance Attribute Details
#total_tests_count ⇒ Object
Returns the value of attribute total_tests_count.
15 16 17 |
# File 'lib/datadog/ci/test_session.rb', line 15 def total_tests_count @total_tests_count end |
Instance Method Details
#ci_job_name ⇒ String
Return the test session's CI job name (e.g. "build", "test", etc.)
45 46 47 |
# File 'lib/datadog/ci/test_session.rb', line 45 def ci_job_name get_tag(Ext::Environment::TAG_JOB_NAME) end |
#ci_provider ⇒ String
Return the test session's CI provider name (e.g. "travis", "circleci", etc.)
39 40 41 |
# File 'lib/datadog/ci/test_session.rb', line 39 def ci_provider get_tag(Ext::Environment::TAG_PROVIDER_NAME) end |
#code_coverage? ⇒ Boolean
53 54 55 |
# File 'lib/datadog/ci/test_session.rb', line 53 def code_coverage? get_tag(Ext::Test::TAG_CODE_COVERAGE_ENABLED) == "true" end |
#finish ⇒ void
This method returns an undefined value.
Finishes the current test session.
19 20 21 22 23 |
# File 'lib/datadog/ci/test_session.rb', line 19 def finish test_visibility.deactivate_test_session super end |
#inheritable_tags ⇒ Hash
Return the test session tags that could be inherited by sub-spans
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/datadog/ci/test_session.rb', line 59 def return @inheritable_tags if defined?(@inheritable_tags) # this method is not synchronized because it does not iterate over the tags collection, but rather # uses synchronized method #get_tag to get each tag value res = {} Ext::Test::INHERITABLE_TAGS.each do |tag| res[tag] = get_tag(tag) end @inheritable_tags = res.freeze end |
#name ⇒ String
Return the test session's name which is equal to test command used
27 28 29 |
# File 'lib/datadog/ci/test_session.rb', line 27 def name get_tag(Ext::Test::TAG_COMMAND) end |
#skipping_tests? ⇒ Boolean
49 50 51 |
# File 'lib/datadog/ci/test_session.rb', line 49 def skipping_tests? get_tag(Ext::Test::TAG_ITR_TEST_SKIPPING_ENABLED) == "true" end |
#test_command ⇒ String
Return the test session's command used to run the tests
33 34 35 |
# File 'lib/datadog/ci/test_session.rb', line 33 def test_command get_tag(Ext::Test::TAG_COMMAND) end |