-
Notifications
You must be signed in to change notification settings - Fork 33
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
stestr load doesn't handle empty subunit input well #219
Comments
So the fundamental issue here is you're trying to run a file/module that's not actually tests. In the '-n' case it's definitely an edge condition we didn't think about and this shouldn't stack trace we should handle this gracefully and say you're specified test module didn't have any subunit output when run. This actually raises a larger issue with the load command (which is actually where the bug comes from) when you pass it input without subunit it doesn't handle this correctly at all, it either raises an exception from subunit-trace (which is what you're hitting) or if you turn off subunit-trace it just silently adds an empty file to the repository. For the case without '-n' it should return an error like: "The specified regex doesn't match with anything" and then exit with a return code of 1. (which is the defined behavior when you pass in an invalid regex: Lines 471 to 472 in 7a1da4f
stestr run nova/tests/unit/virt/libvirt/fakelibvirt.py locally on the nova repo the output I got was:
|
@mtreinish commented on January 29, 2019 6:14 PM:
Ah, good spot! I accidentally missed the
Yes exactly.
OK, so can this be fixed?
That does not work for me - as already reported I do not get any such error. If I had, most likely I would have realised that it does not make sense to pass in a file path without
The trailing |
Sorry I missed you're question here. Yes this should be fixable, it shouldn't be too bad we just need to figure out the best place in stestr load to figure out that the input is empty and return an appropriate error code and message in that case. The complexity is that the actual processing is all handled by setting up a stream processing pipeline and passing the input file-like object to it. So we have 2 approaches to fix it, either being a stage in the testtools/subunit processing pipeline that checks if the input was empty at test run stop time, or just check the output after the processing is done. We've typically done the latter approach because it's a bit simpler to implement and debug, and it doesn't require knowing the internals of testtools and subunit super well (which despite working with for years, I still feel that I really don't). |
It looks the issue was fixed in the stestr 2.5.0 release?
|
Sort of but not for real. It's enough for the original issue in this bug both #263 and #244 fixed issues with the subunit trace handling in the load command so that broken input with subunit-trace enabled wouldn't be fatal. However, it doesn't change load's behavior it will still create an empty result in the repository. That empty result will then break anything else that uses the stored empty stream because nothing knows how to handle an empty stream. For example if you follow that command with |
Issue description
Steps to reproduce the problem
Clone openstack/nova
Try to run a single test file:
Expected behavior
I would expect that the tests in that file are run, as per https://stestr.readthedocs.io/en/latest/MANUAL.html#running-tests which claims:
or if for some reason the file could not be located or its tests not run (e.g. if the project does mess with import paths - I have no idea if that is true for nova), then I expect
stestr
would give a helpful warning or even error explaining what went wrong.Actual behavior
stestr
either crashes with a hopelessly cryptic error (which doesn't even look like a crash but more like a user-facing error, but I've submitted a separate issue #220 about that):or, if discovery is not suppressed, silently runs zero tests with no warning that something went wrong (the
psycopg2
warning is obviously unrelated):Specifications like the version of the project, operating system, or hardware
System information
stestr version (
stestr --version
):2.2.0
Python release (
python --version
):2.7.14
pip packages (
pip freeze
):The text was updated successfully, but these errors were encountered: