lib/datadog/ci/test.rb in datadog-ci-1.4.1 vs lib/datadog/ci/test.rb in datadog-ci-1.5.0

- old
+ new

@@ -68,10 +68,16 @@ # @return [Boolean] true if the test is skipped by the intelligent test runner, false otherwise. def skipped_by_itr? get_tag(Ext::Test::TAG_ITR_SKIPPED_BY_ITR) == "true" end + # Returns "true" if test span represents a retry. + # @return [Boolean] true if this test is a retry, false otherwise. + def is_retry? + get_tag(Ext::Test::TAG_IS_RETRY) == "true" + end + # Marks this test as unskippable by the intelligent test runner. # This must be done before the test execution starts. # # Examples of tests that should be unskippable: # - tests that read files from disk @@ -137,14 +143,21 @@ # @return [nil] if this test does not have parameters def parameters get_tag(Ext::Test::TAG_PARAMETERS) end + # @internal + def any_retry_passed? + !!test_suite&.any_test_retry_passed?(test_id) + end + private - def record_test_result(datadog_status) - test_id = Utils::TestRun.skippable_test_id(name, test_suite_name, parameters) + def test_id + @test_id ||= Utils::TestRun.datadog_test_id(name, test_suite_name, parameters) + end + def record_test_result(datadog_status) # if this test was already executed in this test suite, mark it as retried if test_suite&.test_executed?(test_id) set_tag(Ext::Test::TAG_IS_RETRY, "true") end