Class: Datadog::CI::TestRetries::Driver::RetryFlakeDetection
- Inherits:
-
Base
- Object
- Base
- Datadog::CI::TestRetries::Driver::RetryFlakeDetection
show all
- Defined in:
- lib/datadog/ci/test_retries/driver/retry_flake_detection.rb
Overview
retry every new test up to 10 times (early flake detection) stop early once both a pass and a fail have been observed (flakiness confirmed)
Instance Method Summary
collapse
Methods inherited from Base
#mark_as_retry, #tracks_retry_results?
Constructor Details
#initialize(test_span, max_attempts_thresholds:) ⇒ RetryFlakeDetection
Returns a new instance of RetryFlakeDetection.
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/datadog/ci/test_retries/driver/retry_flake_detection.rb', line 14
def initialize(test_span, max_attempts_thresholds:)
@max_attempts_thresholds = max_attempts_thresholds
@attempts = 0
@max_attempts = 10
@passed_once = !!test_span&.passed?
@failed_once = !!test_span&.failed?
end
|
Instance Method Details
#record_duration(duration) ⇒ Object
39
40
41
42
43
|
# File 'lib/datadog/ci/test_retries/driver/retry_flake_detection.rb', line 39
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
29
30
31
32
33
34
35
36
37
|
# File 'lib/datadog/ci/test_retries/driver/retry_flake_detection.rb', line 29
def record_retry(test_span)
super
@attempts += 1
@passed_once = true if test_span&.passed?
@failed_once = true if test_span&.failed?
Datadog.logger.debug { "Retry Attempts [#{@attempts} / #{@max_attempts}], Passed: [#{@passed_once}], Failed: [#{@failed_once}]" }
end
|
#retry_reason ⇒ Object
45
46
47
|
# File 'lib/datadog/ci/test_retries/driver/retry_flake_detection.rb', line 45
def retry_reason
Ext::Test::RetryReason::RETRY_DETECT_FLAKY
end
|
#should_retry? ⇒ Boolean
25
26
27
|
# File 'lib/datadog/ci/test_retries/driver/retry_flake_detection.rb', line 25
def should_retry?
@attempts < @max_attempts && !flakiness_detected?
end
|