Class: Datadog::CI::TestRetries::Strategy::RetryFlakyFixed

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb

Overview

This strategy retries tests that are flaky and were marked as attempted to be fixed in Datadog Test Management UI.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled:, max_attempts:) ⇒ RetryFlakyFixed

Returns a new instance of RetryFlakyFixed.



15
16
17
18
19
20
21
# File 'lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb', line 15

def initialize(
  enabled:,
  max_attempts:
)
  @enabled = enabled
  @max_attempts = max_attempts
end

Instance Attribute Details

#enabledObject (readonly)

Returns the value of attribute enabled.



13
14
15
# File 'lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb', line 13

def enabled
  @enabled
end

#max_attemptsObject (readonly)

Returns the value of attribute max_attempts.



13
14
15
# File 'lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb', line 13

def max_attempts
  @max_attempts
end

Instance Method Details

#build_driver(test_span) ⇒ Object



34
35
36
37
38
# File 'lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb', line 34

def build_driver(test_span)
  Datadog.logger.debug { "#{test_span.name} is attempt_to_fix, will be retried" }

  Driver::RetryFlakyFixed.new(max_attempts: max_attempts)
end

#configure(library_settings, test_session) ⇒ Object



23
24
25
26
# File 'lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb', line 23

def configure(library_settings, test_session)
  @enabled &&= library_settings.test_management_enabled?
  @max_attempts = library_settings.attempt_to_fix_retries_count || @max_attempts
end

#covers?(test_span) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb', line 28

def covers?(test_span)
  return false unless @enabled

  !!test_span&.attempt_to_fix?
end