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
- #should_retry? ⇒ Boolean
Constructor Details
#initialize(test_span, max_attempts_thresholds:) ⇒ RetryNew
Returns a new instance of RetryNew.
13 14 15 16 17 18 19 20 |
# 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 mark_new_test(test_span) end |
Instance Method Details
#record_duration(duration) ⇒ Object
35 36 37 38 39 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 35 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
26 27 28 29 30 31 32 33 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 26 def record_retry(test_span) super @attempts += 1 mark_new_test(test_span) Datadog.logger.debug { "Retry Attempts [#{@attempts} / #{@max_attempts}]" } end |
#should_retry? ⇒ Boolean
22 23 24 |
# File 'lib/datadog/ci/test_retries/driver/retry_new.rb', line 22 def should_retry? @attempts < @max_attempts end |