stestr icon indicating copy to clipboard operation
stestr copied to clipboard

Add failfast option

Open masayukig opened this issue 6 years ago • 6 comments

Issue description

When we run tests with stestr, stestr execute all of the tests even if the test fails during the execution. I think this is enough for the most of the CI/CD cases. However, if we run a lot of test cases (it takes long time) manually, it might be a good option. It can save the time for users to wait the end of the tests.

NOTE: This is not a bug report but a feature request.

Expected behavior and actual behavior

Expected: A test fails as soon as possible when a test case fails with the failfast option.

Steps to reproduce the problem

N/A

Specifications like the version of the project, operating system, or hardware

N/A

System information

N/A

Additional information

masayukig avatar Dec 11 '18 09:12 masayukig

This might be a related testtools API? https://testtools.readthedocs.io/en/latest/api.html#testtools.TestResult class testtools.TestResult(failfast=False, tb_locals=False)

I don't dig it that much yet though.

masayukig avatar Dec 11 '18 09:12 masayukig

Well part of of the complexity for an option like this is how do we handle multiple workers? Since it's a subprocess we don't have a lot of control over the workers. If one worker fails when we have failfast set how to we gracefully stop running all the other tests.

mtreinish avatar Dec 13 '18 04:12 mtreinish

yeah, that's a good question. I think we don't have a smart way to do that. So, how about making this --failfast option work only with the --serial option?

masayukig avatar Dec 14 '18 07:12 masayukig

This feature is more important than it seems because without it a failure to setup the test environment can easily produce desasters where huge amount of failures with a lot of extra debug information would flood console and logs.

It happened to me on multiple occasions with stestr, on multiple projects. At least in one case it also put the worker to its knees because each test was tryin to start a heavy service: 10gb ram used and all threads maxed forever.

ssbarnea avatar Jan 04 '19 15:01 ssbarnea

@ssbarnea sorry for my delay. I'll revisit here and implement this feature anyway. But if you have any code already, please feel free to submit a PR :)

And #230 looks like almost similar issue? At least, the title is almost the same :) Do you think we need to keep both issues? Or can we merge them?

masayukig avatar Mar 04 '19 12:03 masayukig

I'm feeling the need for this feature right now :)

aspiers avatar Jun 17 '19 13:06 aspiers