Run plugin suite_finished handler before upload#82
Run plugin suite_finished handler before upload#82andmat900 wants to merge 4 commits intoeiffel-community:mainfrom
Conversation
Change-Id: I28dc8a64af90a5e93c4fa5070e787ef517f9193c Signed-off-by: Andrei Matveyeu <andreimu@axis.com>
| self.logger.info("Figure out test outcome.") | ||
| outcome = self.outcome(result, executed, description, test_framework_exit_codes) | ||
| pprint(outcome) | ||
| self.logger.info("Call on_test_suite_finished plugin handlers.") |
| executed = False | ||
| description = str(exception) | ||
| raise | ||
| try: |
There was a problem hiding this comment.
Why do we need another level of nesting?
There was a problem hiding this comment.
The inner try/finally is needed so that on_test_suite_finished and outcome computation run inside the with Workspace block, before Workspace.__exit__ triggers artifact upload.
Without the inner try/finally, if tests raise an exception, the with block would exit immediately (uploading artifacts), and we'd never call the plugin handlers in time. The inner finally guarantees the plugin handlers run even on exception, but still before the workspace context manager cleans up and uploads.
There was a problem hiding this comment.
Then I would rather we create a method. I dont like the sight-line with three levels of nesting
Change-Id: I3de8a51f19740f984841cdd0bf2a6ffce51e5b9b Signed-off-by: Andrei Matveyeu <andreimu@axis.com>
Change-Id: Iff18d474ab3a5b1cb6a08a2765efdc4cd27adcc4 Signed-off-by: Andrei Matveyeu <andreimu@axis.com>
Change-Id: I22244003c771765710533b8b5ccbcb9705cea786 Signed-off-by: Andrei Matveyeu <andreimu@axis.com>
| for plugin in self.plugins: | ||
| plugin.on_test_suite_finished(name, outcome) | ||
|
|
||
| def _run_and_finalize(self, workspace): |
t-persson
left a comment
There was a problem hiding this comment.
Accidentally set approved when I had a comment.
Applicable Issues
Fixes eiffel-community/etos#504
Description of the Change
Move the
on_test_suite_finishedplugin handler call to run before the Workspace context manager exits, which is where artifact upload happens. Previously the handler ran after artifacts were already uploaded, so plugins that needed to create additional artifacts upon suite completion had to handle upload themselves. Now plugins can simply write files to the artifact directory and they will be uploaded automatically.Alternate Designs
Possible Drawbacks
Sign-off
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Andrei Matveyeu, andreimu@axis.com