Skip to content
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

Support fail fast #767

Closed
wants to merge 6 commits into from
Closed

Conversation

AnewTranduil
Copy link

It is a possible solution to the issue: #279
Added an option --fail-fast to the parallel_tests, which stops all the processes if one of them return non zero exit code. As similar feature was implemented at rspec itself it makes it possible to stop whole suit on the first fail.
Checked only with the rspec framework. (Might check other frameworks in the future)

Usage example:

  1. use command like:
    parallel_rspec -n 2 spec/ --fail-fast --test-options '--fail-fast'
  2. use command like:
    parallel_rspec -n 2 spec/ --fail-fast
    while the option --fail-fast will be enabled at the .rspec_parallel

Comments and suggestions appreciated))

Artem-applitools and others added 5 commits July 7, 2020 15:19
… exit code. So it makes possible to stop whole suite for all threads if every thread will works option `--fail-fast`.
… specs will be executed and different puts will be displayed. Changed puts to be the same at all specs to assert amount of puts outputs which should be the same
@AnewTranduil AnewTranduil reopened this Jul 9, 2020
@@ -44,6 +44,7 @@ def execute_in_parallel(items, num_processes, options)
simulate_output_for_ci options[:serialize_stdout] do
Parallel.map(items, :in_threads => num_processes) do |item|
result = yield(item)
ParallelTests.stop_all_processes if result[:exit_status] != 0 && options[:fail_fast]
reprint_output(result, lock.path) if options[:serialize_stdout]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • should go after the printing ?
  • parallel has raise Parallel::Kill, that should work too ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I will change the order

  • raise the exception doesn't seems to be right solution. I would expect that tests will shutdown softly after running they after hooks, where they could perform cleaning code.

["cucumber features/fail1.feature:2 # Scenario: xxx", "cucumber features/fail2.feature:2 # Scenario: xxx"]
else
["cucumber features/fail2.feature:2 # Scenario: xxx", "cucumber features/fail1.feature:2 # Scenario: xxx"]
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz undo these reformattings or make them 2-space indent

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will undo reformatting

Changed order of the command, reprint output before stopping all the processes
@md-hamed
Copy link

@AnewTranduil Any updates regarding this feature? Can I help?

@grosser
Copy link
Owner

grosser commented Jul 24, 2020 via email

@grosser
Copy link
Owner

grosser commented Jul 24, 2020

here we go ... #770 just waiting for CI

@grosser grosser closed this Jul 24, 2020
@grosser
Copy link
Owner

grosser commented Jul 24, 2020

3.1.0

@md-hamed
Copy link

Great! Thanks @grosser!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants