-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add retry feature for failed tests #214
Conversation
@ilslv I think what I want to implement is very similar to
The implementation will :
Regarding the user input (the retry tag) I don't think we have a clean way to prevent bad inputs. So everything that doesn't match the regex will be Also I will try to extract this closure to its own function so I can do some unit tests. But I didn't explore this yet. I suppose I need to keep this function For the next steps :
|
Yes, this functionality should definitely be in enum RetryOrder {
/// Reties `Scenario` right after the failure.
Immediately,
/// Retries `Scenario` in the end.
Postponed,
}
pub type RetryableFn = fn(
&gherkin::Feature,
Option<&gherkin::Rule>,
&gherkin::Scenario,
) -> (RetryOrder, usize); Also we should modify the existing Lines 1404 to 1429 in cf055ac
type RetiesLeft = usize;
type IsRetried = bool;
type Scenarios = HashMap<
ScenarioType,
Vec<(
Arc<gherkin::Feature>,
Option<Arc<gherkin::Rule>>,
Arc<gherkin::Scenario>,
RetriesLeft,
RetryOrder,
IsRetried, // Used to emit right events
)>,
>; So we should re-insert failed
This should be discussed separately, as currently we are runtime-agnostic and introducing |
Thank you for your inputs @ilslv ! I will follow them for the implementation and see how to implement the events 👍 |
6c18a02
to
873310e
Compare
873310e
to
18884ef
Compare
} else { | ||
// For some reason features.scenarios contains an empty vector for the storage. | ||
// It will fail the rest of the execution. How to access the storage so we can | ||
// read and update the retries? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilslv can you maybe help me to understand this part? I try to read and update the storage. Seems like it's empty at this step (the scenario type is set to Concurrent
but there is no vector as a value).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theredfish I don't understand why empty Features::scenarios
might fail the rest of the execution. Features::scenarios
is an Arc<Mutex<HashMap<_, _>>>
where execute()
function you are working with is getting some amount of Scenario
s from via Features::get()
. It may get all the available Scenario
s, in that case HashMap
will indeed be empty.
Scenario
s are inserted via insert_features()
function. This is done to abstract Parser
as a Stream
of Feature
s.
Basically you have 2 Future
s: one is getting Stream
of Feature
s, and inserts them into Features
storage, while another one extracts them and executes Scenario
s.
Closing in favor of #223 |
WIP