-
Notifications
You must be signed in to change notification settings - Fork 290
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
orch/run: Add unit test xml scanner #1792
Conversation
4583c3d
to
c977903
Compare
Why do you think this feature should be embedded in orchestra/run? |
@kshtsk |
The run method is pretty basic method to run a remote command, it should not be overloaded with extra functionality, no specific parsing code should be there. If you want some kind of parsing of specific xml, you might add another method making subcall of run. For example, if you need some shortcut for running test which can produce java specific test, probably it makes sense to have a dedicated function that gives a clue to a user about what is it, for example, remote.nosetest. As an example, take a look at remote.sh method to have an idea of how the run can be reused. |
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.
I do think it's worth considering @kshtsk's view that this functionality ought to be placed outside the orchestra
package.
It could be as simple as creating a new module e.g. teuthology.util.unit_tests
, and moving find_unittest_error
and parse_xml
there. Tasks could then use the feature by doing something like this, or calling a wrapper function which does this:
try:
remote.run(
args=args,
label="s3 tests against rgw",
)
except CommandFailedError:
find_unittest_error(remote, path=unittest_xml)
raise
teuthology/orchestra/run.py
Outdated
else: | ||
return f'XML output not found at `{str(xmlfile)}`!' | ||
except Exception as exc: | ||
raise Exception("Somthing went wrong while searching for error in XML file: " + repr(exc)) |
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.
raise Exception("Somthing went wrong while searching for error in XML file: " + repr(exc)) | |
log.exception("Something went wrong while searching for errors in XML file") | |
raise |
teuthology/orchestra/run.py
Outdated
return (error_message + testcase1_msg).replace("\n", " ") | ||
else: | ||
return f'XML output not found at `{str(xmlfile)}`!' | ||
except Exception as exc: |
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.
except Exception as exc: | |
except Exception: |
d4efb4b
to
1f6fcf0
Compare
Outputs:
|
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.
I went through the logic and it looks good, just have very minor formatting requests.
1f6fcf0
to
c18a5a9
Compare
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.
Looking great!
I'm avoiding merging immediately because I won't have much time to observe today; I can merge tomorrow, or feel free to do so yourself!
27ddeeb
to
c4bef53
Compare
bef9b3e
to
39c0cfc
Compare
1. add 'run_unit_test' to Remote 2. create util/scanner.py 3. new exception: UnitTestError 4. add `lxml` dependency in setup.cfg Signed-off-by: Vallari Agrawal <[email protected]>
and test_run_unit_test in test_remote.py Signed-off-by: Vallari Agrawal <[email protected]>
In UnitTestScanner's final error message, add total count of failures before the first error occurance, like "(total x failed) <message>". Another minor change: add "..." if the failure reason is more than 200 chars. Signed-off-by: Vallari Agrawal <[email protected]>
39c0cfc
to
fec6e47
Compare
This PR adds following changes:
run_unit_test
to RemoteScanner
,UnitTestScanner
,ValgrindScanner
UnitTestError
reason: to throw better exception messages for failures in unit tests and valgrind errors.