-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite cucumber's test retries feature
- Loading branch information
1 parent
917e637
commit 6533091
Showing
13 changed files
with
159 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module CI | ||
module Contrib | ||
module Cucumber | ||
class Filter < ::Cucumber::Core::Filter.new(:configuration) | ||
def test_case(test_case) | ||
test_retries_component.reset_retries! unless test_case_seen[test_case] | ||
|
||
test_case_seen[test_case] = true | ||
configuration.on_event(:test_case_finished) do |event| | ||
next unless retry_required?(test_case, event) | ||
|
||
test_case.describe_to(receiver) | ||
end | ||
|
||
super | ||
end | ||
|
||
private | ||
|
||
def retry_required?(test_case, event) | ||
return false unless event.test_case == test_case | ||
|
||
test_retries_component.should_retry? | ||
end | ||
|
||
def test_case_seen | ||
@test_case_seen ||= Hash.new { |h, k| h[k] = false } | ||
end | ||
|
||
def test_retries_component | ||
@test_retries_component ||= Datadog.send(:components).test_retries | ||
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
18 changes: 0 additions & 18 deletions
18
sig/datadog/ci/contrib/cucumber/configuration_override.rbs
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
module Datadog | ||
module CI | ||
module Contrib | ||
module Cucumber | ||
class Filter < ::Cucumber::Core::Filter | ||
@test_case_seen: untyped | ||
|
||
@test_retries_component: untyped | ||
|
||
def test_case: (untyped test_case) -> untyped | ||
|
||
private | ||
|
||
def retry_required?: (untyped test_case, untyped event) -> (false | untyped) | ||
|
||
def test_case_seen: () -> untyped | ||
|
||
def test_retries_component: () -> untyped | ||
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
Oops, something went wrong.