Class: Datadog::CI::TestRetries::Driver::RetryFailed
- Defined in:
- lib/datadog/ci/test_retries/driver/retry_failed.rb
Instance Attribute Summary collapse
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
Instance Method Summary collapse
-
#initialize(max_attempts:) ⇒ RetryFailed
constructor
A new instance of RetryFailed.
- #record_retry(test_span) ⇒ Object
- #should_retry? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(max_attempts:) ⇒ RetryFailed
Returns a new instance of RetryFailed.
14 15 16 17 18 19 |
# File 'lib/datadog/ci/test_retries/driver/retry_failed.rb', line 14 def initialize(max_attempts:) @max_attempts = max_attempts @attempts = 0 @passed_once = false end |
Instance Attribute Details
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
12 13 14 |
# File 'lib/datadog/ci/test_retries/driver/retry_failed.rb', line 12 def max_attempts @max_attempts end |
Instance Method Details
#record_retry(test_span) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/datadog/ci/test_retries/driver/retry_failed.rb', line 25 def record_retry(test_span) super @attempts += 1 @passed_once = true if test_span&.passed? Datadog.logger.debug { "Retry Attempts [#{@attempts} / #{@max_attempts}], Passed: [#{@passed_once}]" } end |
#should_retry? ⇒ Boolean
21 22 23 |
# File 'lib/datadog/ci/test_retries/driver/retry_failed.rb', line 21 def should_retry? @attempts < @max_attempts && !@passed_once end |