Merge lp:~thumper/launchpad/more-careful-network-service-usage into lp:launchpad/db-devel
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~thumper/launchpad/more-careful-network-service-usage |
| Merge into: | lp:launchpad/db-devel |
| Diff against target: |
465 lines (+224/-17) 10 files modified
lib/canonical/launchpad/webapp/errorlog.py (+9/-1) lib/canonical/launchpad/webapp/interfaces.py (+5/-0) lib/lp/code/model/branchmergeproposaljob.py (+9/-0) lib/lp/code/model/tests/test_branchmergeproposaljobs.py (+98/-1) lib/lp/code/model/tests/test_diff.py (+2/-4) lib/lp/codehosting/scanner/tests/test_bzrsync.py (+4/-2) lib/lp/services/job/runner.py (+22/-7) lib/lp/services/job/tests/test_runner.py (+63/-0) lib/lp/testing/__init__.py (+11/-1) lib/lp/testing/tests/test_fixture.py (+1/-1) |
| To merge this branch: | bzr merge lp:~thumper/launchpad/more-careful-network-service-usage |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Hudson-Doyle | 2010-04-30 | Approve on 2010-05-03 | |
| Björn Tillenius (community) | 2010-04-30 | Approve on 2010-04-30 | |
|
Review via email:
|
|||
Commit Message
Add missing operation descriptions for the jobs, and catch errors that might arise during emailing users about errors.
Description of the Change
This branch adds a default getOperationDes
If the run job raises an error, we attempt to notify the recipients. However, as we have found with staging, that can fail. The extra try/except block catches this failures to notify about failures, but it just logs the error and makes an oops.
Extra tests were added for the other job types to make sure they have a sensible getOperationDes
| Björn Tillenius (bjornt) wrote : | # |
On Fri, Apr 30, 2010 at 05:26:29AM -0000, Tim Penhey wrote:
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -181,13 +184,24 @@
> with self.error_
> dict(job.
> try:
> - self.logger.
> - self.runJob(job)
> - except job.user_
> - job.notifyUserE
> - except Exception:
> + try:
> + self.logger.
> + self.runJob(job)
> + except job.user_
> + job.notifyUserE
> + except Exception:
> + info = sys.exc_info()
> + return self._doOops(job, info)
> + except Exception, e:
> + # This only happens if sending attempting to notify users
> + # about errors fails for some reason (like a misconfigured
> + # email server).
> + self.logger.
> info = sys.exc_info()
> - return self._doOops(job, info)
> + self.error_
> + oops = self.error_
> + # Returning the oops says something went wrong.
> + return oops
As discussed on IRC, this new exception handling is untested. To avoid
things breaking, and to avoid people getting tempted into refactoring
the outer exception handling into using self._doOops(), we need two
tests; one where job.notifyUserE
job.notifyOops() errors out.
Since it's EOD for you now, I'd be willing to let this branch land
without tests (since it won't break anything not already broken), so
that you can QA it more easily on Monday. Given that you promise to
write the tests on Monday, of course.
vote approve
--
Björn Tillenius | https:/
| Tim Penhey (thumper) wrote : | # |
I've updated the test cases for the job runner to confirm that the
errors are handled as expected and that oopses are generated
when we expect them to be.
As a part of this change I have updated the base launchpad TestCase to record
oopses that are generated during the test execution.
These are available as self.oopses and is a list.
This is done by adding an object event to the global error reporting utility
class so that when new oopses are generated and saved it notifies listeners.
The test case starts listening in setUp and stops listening in tearDown thanks
to Fixture code that was in the branch scanner. This code has been moved into
the testing module as no code was currently using it (due to a past change in
the scanner). The tests for the fixtures were also moved into the testing
module.
This also fixes bug 567689, and I did a drive by fix of a spurious test failure,
bug 567257.
| Michael Hudson-Doyle (mwhudson) wrote : | # |
All the new stuff looks great to me. There *may* be oops-related APIs that aren't needed any more, but that can wait.
| Björn Tillenius (bjornt) wrote : | # |
Those changes look good. firing off an event is a good idea, and the tests look good.

As mentioned on IRC, please us logger.exception() instead of using logger.error(e).
Otherwise fine.