lib/datadog/ci.rb in datadog-ci-1.4.1 vs lib/datadog/ci.rb in datadog-ci-1.5.0
- old
+ new
@@ -4,10 +4,11 @@
require_relative "ci/utils/configuration"
require_relative "ci/utils/telemetry"
require_relative "ci/ext/app_types"
require_relative "ci/ext/telemetry"
+require "datadog"
require "datadog/core"
module Datadog
# Datadog CI visibility public API.
#
@@ -25,29 +26,31 @@
#
# The {.start_test_session} method is used to mark the start of the test session:
# ```
# Datadog::CI.start_test_session(
# service: "my-web-site-tests",
- # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
+ # tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" },
+ # total_tests_count: 100
# )
#
# # Somewhere else after test run has ended
# Datadog::CI.active_test_session.finish
# ```
#
# Remember that calling {Datadog::CI::TestSession#finish} is mandatory.
#
# @param [String] service the service name for this session (optional, defaults to DD_SERVICE or repository name)
# @param [Hash<String,String>] tags extra tags which should be added to the test session.
+ # @param [Integer] total_tests_count the total number of tests in the test session (optional, defaults to 0) - it is used to limit the number of new tests retried within session if early flake detection is enabled
# @return [Datadog::CI::TestSession] the active, running {Datadog::CI::TestSession}.
# @return [nil] if test suite level visibility is disabled or CI mode is disabled.
- def start_test_session(service: Utils::Configuration.fetch_service_name("test"), tags: {})
+ def start_test_session(service: Utils::Configuration.fetch_service_name("test"), tags: {}, total_tests_count: 0)
Utils::Telemetry.inc(
Ext::Telemetry::METRIC_MANUAL_API_EVENTS,
1,
{Ext::Telemetry::TAG_EVENT_TYPE => Ext::Telemetry::EventType::SESSION}
)
- test_visibility.start_test_session(service: service, tags: tags)
+ test_visibility.start_test_session(service: service, tags: tags, total_tests_count: total_tests_count)
end
# The active, unfinished test session.
#
# Usage: