Class: Datadog::CI::TestRetries::Driver::RetryNew
- Defined in:
- lib/datadog/ci/test_retries/driver/retry_new.rb
Overview
retry every new test up to 10 times (early flake detection)
Instance Method Summary collapse
-
#initialize(test_span, max_attempts_thresholds:) ⇒ RetryNew
constructor
A new instance of RetryNew.
- #record_duration(duration) ⇒ Object
- #record_retry(test_span) ⇒ Object
- #retry_reason ⇒ Object
- #should_retry? ⇒ Boolean
Constructor Details
#initialize(test_span, max_attempts_thresholds:) ⇒ RetryNew
Returns a new instance of RetryNew.
13 14 15 16 17 18 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 13 def initialize(test_span, max_attempts_thresholds:) @max_attempts_thresholds = max_attempts_thresholds @attempts = 0 # will be changed based on test span duration @max_attempts = 10 end |
Instance Method Details
#record_duration(duration) ⇒ Object
32 33 34 35 36 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 32 def record_duration(duration) @max_attempts = @max_attempts_thresholds.max_attempts_for_duration(duration) Datadog.logger.debug { "Recorded test duration of [#{duration}], new Max Attempts value is [#{@max_attempts}]" } end |
#record_retry(test_span) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 24 def record_retry(test_span) super @attempts += 1 Datadog.logger.debug { "Retry Attempts [#{@attempts} / #{@max_attempts}]" } end |
#retry_reason ⇒ Object
38 39 40 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 38 def retry_reason Ext::Test::RetryReason::RETRY_DETECT_FLAKY end |
#should_retry? ⇒ Boolean
20 21 22 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 20 def should_retry? @attempts < @max_attempts end |