-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from DataDog/anmarchenko/flaky_test_retries_c…
…ucumber [SDTEST-437] Retry failed tests for cucumber
- Loading branch information
Showing
35 changed files
with
614 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "formatter" | ||
|
||
module Datadog | ||
module CI | ||
module Contrib | ||
module Cucumber | ||
# Changes behaviour of Cucumber::Configuration class | ||
module ConfigurationOverride | ||
def self.included(base) | ||
base.prepend(InstanceMethods) | ||
end | ||
|
||
# Instance methods for configuration | ||
module InstanceMethods | ||
def retry_attempts | ||
super if !datadog_test_retries_component&.retry_failed_tests_enabled | ||
|
||
datadog_test_retries_component&.retry_failed_tests_max_attempts | ||
end | ||
|
||
def retry_total_tests | ||
super if !datadog_test_retries_component&.retry_failed_tests_enabled | ||
|
||
datadog_test_retries_component&.retry_failed_tests_total_limit | ||
end | ||
|
||
def datadog_test_retries_component | ||
Datadog.send(:components).test_retries | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module CI | ||
module TestRetries | ||
# Encapsulates the logic to enable test retries, including: | ||
# - retrying failed tests - improve success rate of CI pipelines | ||
# - retrying new tests - detect flaky tests as early as possible to prevent them from being merged | ||
class Component | ||
attr_reader :retry_failed_tests_enabled, :retry_failed_tests_max_attempts, :retry_failed_tests_total_limit | ||
|
||
def initialize( | ||
retry_failed_tests_max_attempts:, | ||
retry_failed_tests_total_limit: | ||
) | ||
# enabled only by remote settings | ||
@retry_failed_tests_enabled = false | ||
@retry_failed_tests_max_attempts = retry_failed_tests_max_attempts | ||
@retry_failed_tests_total_limit = retry_failed_tests_total_limit | ||
end | ||
|
||
def configure(library_settings) | ||
@retry_failed_tests_enabled = library_settings.flaky_test_retries_enabled? | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.