Class: Datadog::CI::TestRetries::Strategy::RetryNew
- Defined in:
- lib/datadog/ci/test_retries/strategy/retry_new.rb
Constant Summary collapse
- DEFAULT_TOTAL_TESTS_COUNT =
100
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#max_attempts_thresholds ⇒ Object
readonly
Returns the value of attribute max_attempts_thresholds.
-
#retried_count ⇒ Object
readonly
Returns the value of attribute retried_count.
-
#total_limit ⇒ Object
readonly
Returns the value of attribute total_limit.
-
#unique_tests_set ⇒ Object
readonly
Returns the value of attribute unique_tests_set.
Instance Method Summary collapse
- #build_driver(test_span) ⇒ Object
- #configure(library_settings, test_session) ⇒ Object
- #covers?(test_span) ⇒ Boolean
-
#initialize(enabled:, unique_tests_client:) ⇒ RetryNew
constructor
A new instance of RetryNew.
Constructor Details
#initialize(enabled:, unique_tests_client:) ⇒ RetryNew
Returns a new instance of RetryNew.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 16 def initialize( enabled:, unique_tests_client: ) @enabled = enabled @unique_tests_set = Set.new # total maximum number of new tests to retry (will be set based on the total number of tests in the session) @total_limit = 0 @retried_count = 0 @unique_tests_client = unique_tests_client end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
14 15 16 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 14 def enabled @enabled end |
#max_attempts_thresholds ⇒ Object (readonly)
Returns the value of attribute max_attempts_thresholds.
14 15 16 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 14 def max_attempts_thresholds @max_attempts_thresholds end |
#retried_count ⇒ Object (readonly)
Returns the value of attribute retried_count.
14 15 16 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 14 def retried_count @retried_count end |
#total_limit ⇒ Object (readonly)
Returns the value of attribute total_limit.
14 15 16 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 14 def total_limit @total_limit end |
#unique_tests_set ⇒ Object (readonly)
Returns the value of attribute unique_tests_set.
14 15 16 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 14 def unique_tests_set @unique_tests_set end |
Instance Method Details
#build_driver(test_span) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 56 def build_driver(test_span) Datadog.logger.debug do "#{test_span.name} is new, will be retried" end @retried_count += 1 Driver::RetryNew.new(test_span, max_attempts_thresholds: @max_attempts_thresholds) end |
#configure(library_settings, test_session) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 43 def configure(library_settings, test_session) @enabled &&= library_settings.early_flake_detection_enabled? return unless @enabled # mark early flake detection enabled for test session test_session.set_tag(Ext::Test::TAG_EARLY_FLAKE_ENABLED, "true") set_max_attempts_thresholds(library_settings) calculate_total_retries_limit(library_settings, test_session) fetch_known_unique_tests(test_session) end |
#covers?(test_span) ⇒ Boolean
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/datadog/ci/test_retries/strategy/retry_new.rb', line 29 def covers?(test_span) return false unless @enabled if @retried_count >= @total_limit Datadog.logger.debug do "Retry new tests limit reached: [#{@retried_count}] out of [#{@total_limit}]" end @enabled = false mark_test_session_faulty(Datadog::CI.active_test_session) end @enabled && !test_span.skipped? && is_new_test?(test_span) end |