Class: Datadog::CI::TestRetries::Strategy::RetryFailed
- Defined in:
- lib/datadog/ci/test_retries/strategy/retry_failed.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
-
#retried_count ⇒ Object
readonly
Returns the value of attribute retried_count.
-
#total_limit ⇒ Object
readonly
Returns the value of attribute total_limit.
Instance Method Summary collapse
- #build_driver(test_span) ⇒ Object
- #configure(library_settings, test_session) ⇒ Object
- #covers?(test_span) ⇒ Boolean
-
#initialize(enabled:, max_attempts:, total_limit:) ⇒ RetryFailed
constructor
A new instance of RetryFailed.
Constructor Details
#initialize(enabled:, max_attempts:, total_limit:) ⇒ RetryFailed
Returns a new instance of RetryFailed.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 15 def initialize( enabled:, max_attempts:, total_limit: ) @enabled = enabled @max_attempts = max_attempts @total_limit = total_limit @retried_count = 0 end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
12 13 14 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 12 def enabled @enabled end |
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
12 13 14 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 12 def max_attempts @max_attempts end |
#retried_count ⇒ Object (readonly)
Returns the value of attribute retried_count.
12 13 14 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 12 def retried_count @retried_count end |
#total_limit ⇒ Object (readonly)
Returns the value of attribute total_limit.
12 13 14 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 12 def total_limit @total_limit end |
Instance Method Details
#build_driver(test_span) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 43 def build_driver(test_span) Datadog.logger.debug { "#{test_span.name} failed, will be retried" } @retried_count += 1 Driver::RetryFailed.new(max_attempts: max_attempts) end |
#configure(library_settings, test_session) ⇒ Object
39 40 41 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 39 def configure(library_settings, test_session) @enabled &&= library_settings.flaky_test_retries_enabled? end |
#covers?(test_span) ⇒ Boolean
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/datadog/ci/test_retries/strategy/retry_failed.rb', line 26 def covers?(test_span) return false unless @enabled if @retried_count >= @total_limit Datadog.logger.debug do "Retry failed tests limit reached: [#{@retried_count}] out of [#{@total_limit}]" end @enabled = false end @enabled && !!test_span&.failed? end |