Merge lp:~thumper/launchpad/all-code-review-email-using-jobs into lp:launchpad/db-devel

Proposed by Tim Penhey
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~thumper/launchpad/all-code-review-email-using-jobs
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~thumper/launchpad/merge-proposal-job-source
Diff against target: 1899 lines (+256/-476)
60 files modified
Makefile (+4/-5)
configs/development/launchpad-lazr.conf (+2/-2)
configs/testrunner/launchpad-lazr.conf (+2/-6)
cronscripts/merge-proposal-jobs.py (+22/-30)
cronscripts/update_preview_diffs.py (+0/-38)
database/schema/security.cfg (+1/-13)
lib/canonical/config/schema-lazr.conf (+2/-14)
lib/canonical/launchpad/doc/product-update-remote-product-script.txt (+1/-1)
lib/lp/answers/doc/expiration.txt (+1/-1)
lib/lp/bugs/doc/bugnotification-sending.txt (+1/-1)
lib/lp/bugs/doc/bugtask-expiration.txt (+1/-1)
lib/lp/bugs/doc/bugtask.txt (+1/-1)
lib/lp/bugs/doc/checkwatches.txt (+1/-1)
lib/lp/bugs/doc/cve-update.txt (+2/-2)
lib/lp/bugs/tests/test_apportjob.py (+1/-1)
lib/lp/bugs/tests/test_bugheat.py (+1/-1)
lib/lp/code/doc/branch-merge-proposal-notifications.txt (+11/-5)
lib/lp/code/doc/codereviewcomment.txt (+6/-12)
lib/lp/code/interfaces/branchmergeproposal.py (+4/-3)
lib/lp/code/mail/branch.py (+0/-1)
lib/lp/code/mail/tests/test_branchmergeproposal.py (+11/-10)
lib/lp/code/mail/tests/test_codehandler.py (+11/-13)
lib/lp/code/mail/tests/test_codereviewcomment.py (+1/-1)
lib/lp/code/model/branchmergeproposal.py (+6/-9)
lib/lp/code/model/branchmergeproposaljob.py (+2/-0)
lib/lp/code/model/tests/test_branchcloud.py (+4/-3)
lib/lp/code/model/tests/test_branchmergeproposaljobs.py (+10/-29)
lib/lp/code/model/tests/test_branchmergeproposals.py (+9/-56)
lib/lp/code/model/tests/test_diff.py (+4/-0)
lib/lp/code/scripts/tests/test_create_merge_proposals.py (+3/-3)
lib/lp/code/scripts/tests/test_merge_proposal_jobs.py (+9/-47)
lib/lp/code/scripts/tests/test_reclaim_branch_space.py (+3/-4)
lib/lp/code/scripts/tests/test_scan_branches.py (+2/-2)
lib/lp/code/scripts/tests/test_sendbranchmail.py (+13/-8)
lib/lp/code/scripts/tests/test_update_preview_diffs.py (+0/-93)
lib/lp/code/scripts/tests/test_upgrade_branches.py (+4/-4)
lib/lp/code/tests/helpers.py (+16/-0)
lib/lp/codehosting/scanner/tests/test_bzrsync.py (+6/-5)
lib/lp/codehosting/scanner/tests/test_mergedetection.py (+16/-4)
lib/lp/hardwaredb/doc/hwdb-submission.txt (+4/-4)
lib/lp/registry/doc/distribution-mirror.txt (+5/-5)
lib/lp/registry/doc/person-karma.txt (+1/-1)
lib/lp/registry/doc/sourceforge-remote-products.txt (+1/-1)
lib/lp/registry/doc/standing.txt (+2/-2)
lib/lp/services/job/tests/test_runner.py (+6/-2)
lib/lp/services/mail/sendmail.py (+20/-13)
lib/lp/soyuz/doc/buildd-slavescanner.txt (+2/-2)
lib/lp/soyuz/doc/gina.txt (+1/-1)
lib/lp/soyuz/doc/manage-chroot.txt (+1/-1)
lib/lp/soyuz/doc/package-cache-script.txt (+1/-1)
lib/lp/soyuz/scripts/tests/test_processupload.py (+1/-1)
lib/lp/translations/doc/distroseries-translations-copy.txt (+4/-2)
lib/lp/translations/doc/fix_translation_credits.txt (+2/-1)
lib/lp/translations/doc/poexport-language-pack.txt (+2/-1)
lib/lp/translations/doc/poexport-request.txt (+1/-1)
lib/lp/translations/doc/pofile-verify-stats.txt (+2/-2)
lib/lp/translations/doc/rosetta-poimport-script.txt (+1/-1)
lib/lp/translations/doc/sourcepackagerelease-translations.txt (+3/-2)
lib/lp/translations/doc/translations-export-to-branch.txt (+1/-1)
lib/lp/translations/scripts/tests/test_translations_to_branch.py (+1/-1)
To merge this branch: bzr merge lp:~thumper/launchpad/all-code-review-email-using-jobs
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+22439@code.launchpad.net

Commit message

All code review email is now sent using a single job.

Description of the change

This branch is the end of the pipeline.

This is the branch that is going to be merged, and it will be merged
into db-devel, as it is a large change and also landing a change that
would impact edge in such a way that it wouldn't send email is a
"bad thing" (TM).

$ bzr pipes
   remove-thumper-from-sample-data
   code-review-comment-email-job
   new-reviewer-email-job
   bmp-notification-email-job
   format-address-for-person
   subscriber-move-and-cleanup
   merge-proposal-job-source
* all-code-review-email-using-jobs

This branch is the branch that provides the cronjob to run all the
merge proposal jobs. The old mpcreationjobs.py cronscript is renamed
to merge-proposal-jobs.py. Configs are updated, the Makefile adjusted,
database permissions and users changed.

The jobs are tested elsewhere, so the script test just makes sure that
the process can start, load its config, access the database, do the query,
produce logging and finish.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks fine, modulo the comment already made on skype: so long as there are some tests somewhere of the jobs running that run as the correct db user, to catch missing permissions.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2010-04-06 21:43:23 +0000
+++ Makefile 2010-04-07 18:05:36 +0000
@@ -203,9 +203,9 @@
203ftest_inplace: inplace203ftest_inplace: inplace
204 bin/test -f $(TESTFLAGS) $(TESTOPTS)204 bin/test -f $(TESTFLAGS) $(TESTOPTS)
205205
206mpcreationjobs:206merge-proposal-jobs:
207 # Handle merge proposal creations.207 # Handle merge proposal email jobs.
208 $(PY) cronscripts/mpcreationjobs.py208 $(PY) cronscripts/merge-proposal-jobs.py -v
209209
210run: inplace stop210run: inplace stop
211 $(RM) thread*.request211 $(RM) thread*.request
@@ -249,8 +249,7 @@
249 # Scan branches from the filesystem into the database.249 # Scan branches from the filesystem into the database.
250 $(PY) cronscripts/scan_branches.py250 $(PY) cronscripts/scan_branches.py
251251
252252sync_branches: pull_branches scan_branches merge-proposal-jobs
253sync_branches: pull_branches scan_branches mpcreationjobs
254253
255$(BZR_VERSION_INFO):254$(BZR_VERSION_INFO):
256 scripts/update-bzr-version-info.sh255 scripts/update-bzr-version-info.sh
257256
=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf 2010-04-06 13:25:20 +0000
+++ configs/development/launchpad-lazr.conf 2010-04-07 18:05:36 +0000
@@ -196,9 +196,9 @@
196port: 11217196port: 11217
197memory_size: 1197memory_size: 1
198198
199[mpcreationjobs]199[merge_proposal_jobs]
200error_dir: /var/tmp/codehosting.test200error_dir: /var/tmp/codehosting.test
201oops_prefix: DMPCR201oops_prefix: DMPJ
202202
203[personalpackagearchive]203[personalpackagearchive]
204root: /var/tmp/ppa/204root: /var/tmp/ppa/
205205
=== modified file 'configs/testrunner/launchpad-lazr.conf'
--- configs/testrunner/launchpad-lazr.conf 2010-03-30 17:25:52 +0000
+++ configs/testrunner/launchpad-lazr.conf 2010-04-07 18:05:36 +0000
@@ -172,12 +172,8 @@
172# processes spawned through some other mechanism.172# processes spawned through some other mechanism.
173port: 11242173port: 11242
174174
175[mpcreationjobs]175[merge_proposal_jobs]
176oops_prefix: TMPCJ176oops_prefix: TMPJ
177error_dir: /var/tmp/codehosting.test
178
179[update_preview_diffs]
180oops_prefix: TUPD
181error_dir: /var/tmp/codehosting.test177error_dir: /var/tmp/codehosting.test
182178
183[upgrade_branches]179[upgrade_branches]
184180
=== renamed file 'cronscripts/mpcreationjobs.py' => 'cronscripts/merge-proposal-jobs.py'
--- cronscripts/mpcreationjobs.py 2010-02-16 15:25:52 +0000
+++ cronscripts/merge-proposal-jobs.py 2010-04-07 18:05:36 +0000
@@ -1,48 +1,40 @@
1#!/usr/bin/python2.5 -S1#!/usr/bin/python2.5 -S
2#2#
3# Copyright 2009 Canonical Ltd. This software is licensed under the3# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
4# GNU Affero General Public License version 3 (see the file LICENSE).4# GNU Affero General Public License version 3 (see the file LICENSE).
55
6# pylint: disable-msg=W04036# pylint: disable-msg=W0403
77
8"""Handle new BranchMergeProposals.8"""Handle jobs for BranchMergeProposals.
99
10This script generates a diff for the merge proposal if needed, then notifies10This script handles all job types for branch merge proposals.
11all interested parties about the merge proposal.
12"""11"""
1312
14__metaclass__ = type13__metaclass__ = type
1514
16import _pythonpath15import _pythonpath
17from zope.component import getUtility
1816
19from canonical.config import config17# The following line is a horrible hack, but unfortunately necessary right now
20from lp.codehosting.vfs import get_scanner_server18# to stop import errors from circular imports.
21from lp.services.job.runner import JobRunner19import canonical.launchpad.interfaces
22from lp.code.interfaces.branchmergeproposal import (20from lp.code.interfaces.branchmergeproposal import (
23 IMergeProposalCreatedJobSource,)21 IBranchMergeProposalJobSource,
24from lp.services.scripts.base import LaunchpadCronScript22 )
25from canonical.launchpad.webapp.errorlog import globalErrorUtility23from lp.services.job.runner import JobCronScript, TwistedJobRunner
2624
2725
28class RunMergeProposalCreatedJobs(LaunchpadCronScript):26class RunMergeProposalJobs(JobCronScript):
29 """Run merge proposal creation jobs."""27 """Run all merge proposal jobs."""
3028
31 def main(self):29 config_name = 'merge_proposal_jobs'
32 globalErrorUtility.configure('mpcreationjobs')30 source_interface = IBranchMergeProposalJobSource
33 job_source = getUtility(IMergeProposalCreatedJobSource)31
34 runner = JobRunner.fromReady(job_source, self.logger)32 def __init__(self):
35 server = get_scanner_server()33 super(RunMergeProposalJobs, self).__init__(
36 server.start_server()34 runner_class=TwistedJobRunner,
37 try:35 script_name='merge-proposal-jobs')
38 runner.runAll()
39 finally:
40 server.stop_server()
41 self.logger.info(
42 'Ran %d MergeProposalCreatedJobs.', len(runner.completed_jobs))
4336
4437
45if __name__ == '__main__':38if __name__ == '__main__':
46 script = RunMergeProposalCreatedJobs(39 script = RunMergeProposalJobs()
47 'mpcreationjobs', config.mpcreationjobs.dbuser)
48 script.lock_and_run()40 script.lock_and_run()
4941
=== removed file 'cronscripts/update_preview_diffs.py'
--- cronscripts/update_preview_diffs.py 2010-02-16 15:25:52 +0000
+++ cronscripts/update_preview_diffs.py 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1#!/usr/bin/python2.5 -S
2#
3# Copyright 2009 Canonical Ltd. This software is licensed under the
4# GNU Affero General Public License version 3 (see the file LICENSE).
5
6# pylint: disable-msg=W0403
7
8"""Update or create previews diffs for branch merge proposals."""
9
10__metaclass__ = type
11
12import _pythonpath
13
14from lp.services.job.runner import JobCronScript, JobRunner, TwistedJobRunner
15from lp.code.interfaces.branchmergeproposal import (
16 IUpdatePreviewDiffJobSource,)
17
18
19class RunUpdatePreviewDiffJobs(JobCronScript):
20 """Run UpdatePreviewDiff jobs."""
21
22 config_name = 'update_preview_diffs'
23 source_interface = IUpdatePreviewDiffJobSource
24
25 def __init__(self):
26 super(RunUpdatePreviewDiffJobs, self).__init__()
27 if self.options.twisted:
28 self.runner_class = TwistedJobRunner
29 else:
30 self.runner_class = JobRunner
31
32 def add_my_options(self):
33 self.parser.add_option('--twisted', action='store_true')
34
35
36if __name__ == '__main__':
37 script = RunUpdatePreviewDiffJobs()
38 script.lock_and_run()
390
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-04-05 12:44:46 +0000
+++ database/schema/security.cfg 2010-04-07 18:05:36 +0000
@@ -1682,7 +1682,7 @@
1682public.teamparticipation = SELECT1682public.teamparticipation = SELECT
1683public.validpersoncache = SELECT1683public.validpersoncache = SELECT
16841684
1685[mp-creation-job]1685[merge-proposal-jobs]
1686type=user1686type=user
1687groups=script1687groups=script
1688public.account = SELECT1688public.account = SELECT
@@ -1719,18 +1719,6 @@
1719public.teamparticipation = SELECT1719public.teamparticipation = SELECT
1720public.validpersoncache = SELECT1720public.validpersoncache = SELECT
17211721
1722[update-preview-diffs]
1723type=user
1724groups=script
1725public.branch = SELECT
1726public.branchmergeproposal = SELECT, UPDATE
1727public.branchmergeproposaljob = SELECT
1728public.diff = SELECT, INSERT
1729public.job = SELECT, UPDATE
1730public.libraryfilealias = SELECT, INSERT
1731public.libraryfilecontent = SELECT, INSERT
1732public.previewdiff = SELECT, INSERT
1733
1734[upgrade-branches]1722[upgrade-branches]
1735type=user1723type=user
1736groups=script1724groups=script
17371725
=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf 2010-04-07 18:05:11 +0000
+++ lib/canonical/config/schema-lazr.conf 2010-04-07 18:05:36 +0000
@@ -1412,10 +1412,10 @@
1412port: 112171412port: 11217
14131413
14141414
1415[mpcreationjobs]1415[merge_proposal_jobs]
1416# The database user which will be used by this process.1416# The database user which will be used by this process.
1417# datatype: string1417# datatype: string
1418dbuser: mp-creation-job1418dbuser: merge-proposal-jobs
1419storm_cache: generational1419storm_cache: generational
1420storm_cache_size: 5001420storm_cache_size: 500
14211421
@@ -1428,18 +1428,6 @@
1428# See [error_reports].1428# See [error_reports].
1429copy_to_zlog: false1429copy_to_zlog: false
14301430
1431[update_preview_diffs]
1432dbuser: update-preview-diffs
1433
1434# See [error_reports].
1435error_dir: none
1436
1437# See [error_reports].
1438oops_prefix: none
1439
1440# See [error_reports].
1441copy_to_zlog: false
1442
1443[upgrade_branches]1431[upgrade_branches]
1444dbuser: upgrade-branches1432dbuser: upgrade-branches
14451433
14461434
=== modified file 'lib/canonical/launchpad/doc/product-update-remote-product-script.txt'
--- lib/canonical/launchpad/doc/product-update-remote-product-script.txt 2009-03-27 03:29:31 +0000
+++ lib/canonical/launchpad/doc/product-update-remote-product-script.txt 2010-04-07 18:05:36 +0000
@@ -14,7 +14,7 @@
14 014 0
1515
16 >>> print err16 >>> print err
17 INFO creating lockfile17 INFO Creating lockfile: /var/lock/launchpad-updateremoteproduct.lock
18 INFO 0 projects using BUGZILLA needing updating.18 INFO 0 projects using BUGZILLA needing updating.
19 ...19 ...
20 INFO 0 projects using RT needing updating.20 INFO 0 projects using RT needing updating.
2121
=== modified file 'lib/lp/answers/doc/expiration.txt'
--- lib/lp/answers/doc/expiration.txt 2009-07-23 17:49:31 +0000
+++ lib/lp/answers/doc/expiration.txt 2010-04-07 18:05:36 +0000
@@ -132,7 +132,7 @@
132 ... stderr=subprocess.PIPE)132 ... stderr=subprocess.PIPE)
133 >>> (out, err) = process.communicate()133 >>> (out, err) = process.communicate()
134 >>> print err134 >>> print err
135 INFO creating lockfile135 INFO Creating lockfile: /var/lock/launchpad-expire-questions.lock
136 INFO Expiring OPEN and NEEDSINFO questions without activity for the136 INFO Expiring OPEN and NEEDSINFO questions without activity for the
137 last 15 days.137 last 15 days.
138 INFO Found 5 questions to expire.138 INFO Found 5 questions to expire.
139139
=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
--- lib/lp/bugs/doc/bugnotification-sending.txt 2009-12-24 01:41:54 +0000
+++ lib/lp/bugs/doc/bugnotification-sending.txt 2010-04-07 18:05:36 +0000
@@ -984,7 +984,7 @@
984 >>> process.returncode984 >>> process.returncode
985 0985 0
986 >>> print err986 >>> print err
987 INFO creating lockfile987 INFO Creating lockfile: /var/lock/launchpad-send-bug-notifications.lock
988 INFO Notifying mark@example.com about bug 2.988 INFO Notifying mark@example.com about bug 2.
989 ...989 ...
990 INFO Notifying support@ubuntu.com about bug 2.990 INFO Notifying support@ubuntu.com about bug 2.
991991
=== modified file 'lib/lp/bugs/doc/bugtask-expiration.txt'
--- lib/lp/bugs/doc/bugtask-expiration.txt 2009-06-12 16:36:02 +0000
+++ lib/lp/bugs/doc/bugtask-expiration.txt 2010-04-07 18:05:36 +0000
@@ -445,7 +445,7 @@
445 ... stderr=subprocess.PIPE)445 ... stderr=subprocess.PIPE)
446 >>> (out, err) = process.communicate()446 >>> (out, err) = process.communicate()
447 >>> print err447 >>> print err
448 INFO creating lockfile448 INFO Creating lockfile: /var/lock/launchpad-expire-bugtasks.lock
449 INFO Expiring unattended, INCOMPLETE bugtasks older than449 INFO Expiring unattended, INCOMPLETE bugtasks older than
450 60 days for projects that use Launchpad Bugs.450 60 days for projects that use Launchpad Bugs.
451 INFO Found 3 bugtasks to expire.451 INFO Found 3 bugtasks to expire.
452452
=== modified file 'lib/lp/bugs/doc/bugtask.txt'
--- lib/lp/bugs/doc/bugtask.txt 2010-01-21 17:40:23 +0000
+++ lib/lp/bugs/doc/bugtask.txt 2010-04-07 18:05:36 +0000
@@ -1104,7 +1104,7 @@
1104 >>> (out, err) = process.communicate()1104 >>> (out, err) = process.communicate()
11051105
1106 >>> print err1106 >>> print err
1107 INFO creating lockfile1107 INFO Creating lockfile: /var/lock/launchpad-launchpad-targetnamecacheupdater.lock
1108 INFO Updating targetname cache of bugtasks.1108 INFO Updating targetname cache of bugtasks.
1109 INFO Updating 1 BugTasks (starting id: 2).1109 INFO Updating 1 BugTasks (starting id: 2).
1110 INFO Updating ...BugTasks...1110 INFO Updating ...BugTasks...
11111111
=== modified file 'lib/lp/bugs/doc/checkwatches.txt'
--- lib/lp/bugs/doc/checkwatches.txt 2010-03-30 17:25:52 +0000
+++ lib/lp/bugs/doc/checkwatches.txt 2010-04-07 18:05:36 +0000
@@ -44,7 +44,7 @@
44 044 0
4545
46 >>> print err46 >>> print err
47 INFO creating lockfile47 INFO Creating lockfile: /var/lock/launchpad-checkwatches.lock
48 DEBUG Using a global batch size of None48 DEBUG Using a global batch size of None
49 DEBUG Skipping updating Ubuntu Bugzilla watches.49 DEBUG Skipping updating Ubuntu Bugzilla watches.
50 DEBUG No watches to update on http://bugs.debian.org50 DEBUG No watches to update on http://bugs.debian.org
5151
=== modified file 'lib/lp/bugs/doc/cve-update.txt'
--- lib/lp/bugs/doc/cve-update.txt 2009-06-12 16:36:02 +0000
+++ lib/lp/bugs/doc/cve-update.txt 2010-04-07 18:05:36 +0000
@@ -37,7 +37,7 @@
37 ... )37 ... )
38 >>> (output, empty) = process.communicate()38 >>> (output, empty) = process.communicate()
39 >>> print output39 >>> print output
40 INFO creating lockfile40 INFO Creating lockfile: /var/lock/launchpad-updatecve.lock
41 ...41 ...
42 INFO CVE-1999-0002 created42 INFO CVE-1999-0002 created
43 INFO Creating new SGI reference for 1999-000243 INFO Creating new SGI reference for 1999-0002
@@ -91,7 +91,7 @@
91 ... )91 ... )
92 >>> (output, empty) = process.communicate()92 >>> (output, empty) = process.communicate()
93 >>> print output93 >>> print output
94 INFO creating lockfile94 INFO Creating lockfile: /var/lock/launchpad-updatecve.lock
95 ...95 ...
96 INFO Creating new CERT reference for 1999-000296 INFO Creating new CERT reference for 1999-0002
97 INFO Creating new CIAC reference for 1999-000297 INFO Creating new CIAC reference for 1999-0002
9898
=== modified file 'lib/lp/bugs/tests/test_apportjob.py'
--- lib/lp/bugs/tests/test_apportjob.py 2010-02-26 11:48:40 +0000
+++ lib/lp/bugs/tests/test_apportjob.py 2010-04-07 18:05:36 +0000
@@ -272,7 +272,7 @@
272 expect_returncode=0)272 expect_returncode=0)
273 self.assertEqual('', stdout)273 self.assertEqual('', stdout)
274 self.assertIn(274 self.assertIn(
275 'INFO Ran 1 IProcessApportBlobJobSource jobs.\n', stderr)275 'INFO Ran 1 ProcessApportBlobJob jobs.\n', stderr)
276276
277 def test_getFileBugData(self):277 def test_getFileBugData(self):
278 # The IProcessApportBlobJobSource.getFileBugData() method278 # The IProcessApportBlobJobSource.getFileBugData() method
279279
=== modified file 'lib/lp/bugs/tests/test_bugheat.py'
--- lib/lp/bugs/tests/test_bugheat.py 2010-02-25 21:37:02 +0000
+++ lib/lp/bugs/tests/test_bugheat.py 2010-04-07 18:05:36 +0000
@@ -96,7 +96,7 @@
96 expect_returncode=0)96 expect_returncode=0)
97 self.assertEqual('', stdout)97 self.assertEqual('', stdout)
98 self.assertIn(98 self.assertIn(
99 'INFO Ran 1 ICalculateBugHeatJobSource jobs.\n', stderr)99 'INFO Ran 1 CalculateBugHeatJob jobs.\n', stderr)
100100
101 def test_getOopsVars(self):101 def test_getOopsVars(self):
102 # BugJobDerived.getOopsVars() returns the variables to be used102 # BugJobDerived.getOopsVars() returns the variables to be used
103103
=== modified file 'lib/lp/code/doc/branch-merge-proposal-notifications.txt'
--- lib/lp/code/doc/branch-merge-proposal-notifications.txt 2010-02-19 02:15:27 +0000
+++ lib/lp/code/doc/branch-merge-proposal-notifications.txt 2010-04-07 18:05:36 +0000
@@ -15,7 +15,7 @@
15 ... BranchSubscriptionDiffSize, BranchSubscriptionNotificationLevel,15 ... BranchSubscriptionDiffSize, BranchSubscriptionNotificationLevel,
16 ... CodeReviewNotificationLevel)16 ... CodeReviewNotificationLevel)
17 >>> from lp.code.interfaces.branchmergeproposal import (17 >>> from lp.code.interfaces.branchmergeproposal import (
18 ... IMergeProposalCreatedJobSource)18 ... IBranchMergeProposalJobSource)
19 >>> from lp.code.model.diff import PreviewDiff19 >>> from lp.code.model.diff import PreviewDiff
20 >>> from lp.testing.mail_helpers import pop_notifications20 >>> from lp.testing.mail_helpers import pop_notifications
21 >>> import transaction21 >>> import transaction
@@ -103,8 +103,11 @@
103 >>> bmp = source_branch.addLandingTarget(103 >>> bmp = source_branch.addLandingTarget(
104 ... registrant, target_branch)104 ... registrant, target_branch)
105 >>> removeSecurityProxy(bmp).preview_diff = preview_diff105 >>> removeSecurityProxy(bmp).preview_diff = preview_diff
106 >>> [job,] = list(getUtility(IMergeProposalCreatedJobSource).iterReady())106 >>> # Fake the update preview diff as done.
107 >>> job.run(_create_preview=False)107 >>> bmp.next_preview_diff_job.start()
108 >>> bmp.next_preview_diff_job.complete()
109 >>> [job] = list(getUtility(IBranchMergeProposalJobSource).iterReady())
110 >>> job.run()
108 >>> notifications = pop_notifications(111 >>> notifications = pop_notifications(
109 ... sort_key=lambda n: n.get('X-Envelope-To'))112 ... sort_key=lambda n: n.get('X-Envelope-To'))
110113
@@ -155,8 +158,11 @@
155 ... registrant, target_branch,158 ... registrant, target_branch,
156 ... description=initial_comment, review_requests=reviewers)159 ... description=initial_comment, review_requests=reviewers)
157 >>> removeSecurityProxy(bmp).preview_diff = preview_diff160 >>> removeSecurityProxy(bmp).preview_diff = preview_diff
158 >>> [job,] = list(getUtility(IMergeProposalCreatedJobSource).iterReady())161 >>> # Fake the update preview diff as done.
159 >>> job.run(_create_preview=False)162 >>> bmp.next_preview_diff_job.start()
163 >>> bmp.next_preview_diff_job.complete()
164 >>> [job] = list(getUtility(IBranchMergeProposalJobSource).iterReady())
165 >>> job.run()
160 >>> notifications = pop_notifications(166 >>> notifications = pop_notifications(
161 ... sort_key=lambda n: n.get('X-Envelope-To'))167 ... sort_key=lambda n: n.get('X-Envelope-To'))
162 >>> for notification in notifications:168 >>> for notification in notifications:
163169
=== modified file 'lib/lp/code/doc/codereviewcomment.txt'
--- lib/lp/code/doc/codereviewcomment.txt 2010-04-07 18:05:11 +0000
+++ lib/lp/code/doc/codereviewcomment.txt 2010-04-07 18:05:36 +0000
@@ -48,19 +48,11 @@
48When comments are added, a job is created to send the emails to the48When comments are added, a job is created to send the emails to the
49subscribers of the merge proposal.49subscribers of the merge proposal.
5050
51 >>> from lp.code.interfaces.branchmergeproposal import (
52 ... ICodeReviewCommentEmailJobSource)
53 >>> # Needed for now to make the iterReady show the jobs.51 >>> # Needed for now to make the iterReady show the jobs.
54 >>> factory.makeRevisionsForBranch(merge_proposal.source_branch)52 >>> factory.makeRevisionsForBranch(merge_proposal.source_branch)
55 >>> jobs = list(getUtility(ICodeReviewCommentEmailJobSource).iterReady())53 >>> factory.makeRevisionsForBranch(merge_proposal.target_branch)
56 >>> print len(jobs)54 >>> from lp.code.tests.helpers import mark_all_merge_proposal_jobs_done
57 355 >>> mark_all_merge_proposal_jobs_done()
58
59Since we don't care about these, let's mark them as done.
60
61 >>> for job in jobs:
62 ... job.start()
63 ... job.complete()
6456
65If there is a subscriber to any of the branches involved in the merge,57If there is a subscriber to any of the branches involved in the merge,
66a notification is produced when the comment is created.58a notification is produced when the comment is created.
@@ -84,7 +76,9 @@
8476
85Now run the pending job to send the email.77Now run the pending job to send the email.
8678
87 >>> [job] = list(getUtility(ICodeReviewCommentEmailJobSource).iterReady())79 >>> from lp.code.interfaces.branchmergeproposal import (
80 ... IBranchMergeProposalJobSource)
81 >>> [job] = list(getUtility(IBranchMergeProposalJobSource).iterReady())
88 >>> job.run()82 >>> job.run()
8983
90 >>> notifications = pop_notifications()84 >>> notifications = pop_notifications()
9185
=== modified file 'lib/lp/code/interfaces/branchmergeproposal.py'
--- lib/lp/code/interfaces/branchmergeproposal.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/interfaces/branchmergeproposal.py 2010-04-07 18:05:36 +0000
@@ -583,7 +583,7 @@
583 """583 """
584584
585585
586class ICreateMergeProposalJobSource(Interface):586class ICreateMergeProposalJobSource(IJobSource):
587 """Acquire MergeProposalJobs."""587 """Acquire MergeProposalJobs."""
588588
589 def create(message_bytes):589 def create(message_bytes):
@@ -635,7 +635,7 @@
635 """Interface for the job to sends review request emails."""635 """Interface for the job to sends review request emails."""
636636
637 reviewer = Attribute('The person or team asked to do the review.')637 reviewer = Attribute('The person or team asked to do the review.')
638 requester = Attribute('The person who as asked for the review.')638 requester = Attribute('The person who has asked for the review.')
639639
640640
641class IReviewRequestedEmailJobSource(Interface):641class IReviewRequestedEmailJobSource(Interface):
@@ -652,7 +652,8 @@
652 """Interface for the job to sends email about merge proposal updates."""652 """Interface for the job to sends email about merge proposal updates."""
653653
654 editor = Attribute('The person that did the editing.')654 editor = Attribute('The person that did the editing.')
655 delta_text = Attribute('The textual representation of the changed fields.')655 delta_text = Attribute(
656 'The textual representation of the changed fields.')
656657
657658
658class IMergeProposalUpdatedEmailJobSource(Interface):659class IMergeProposalUpdatedEmailJobSource(Interface):
659660
=== modified file 'lib/lp/code/mail/branch.py'
--- lib/lp/code/mail/branch.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/mail/branch.py 2010-04-07 18:05:36 +0000
@@ -92,7 +92,6 @@
9292
93 The registrant will be the sole recipient.93 The registrant will be the sole recipient.
94 """94 """
95 branch = merge_proposal.source_branch
96 reason_template = 'You proposed %(branch_name)s for merging.'95 reason_template = 'You proposed %(branch_name)s for merging.'
97 return cls(merge_proposal.registrant, merge_proposal.registrant,96 return cls(merge_proposal.registrant, merge_proposal.registrant,
98 merge_proposal.source_branch,97 merge_proposal.source_branch,
9998
=== modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py'
--- lib/lp/code/mail/tests/test_branchmergeproposal.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/mail/tests/test_branchmergeproposal.py 2010-04-07 18:05:36 +0000
@@ -4,9 +4,10 @@
4"""Tests for BranchMergeProposal mailings"""4"""Tests for BranchMergeProposal mailings"""
55
6from difflib import unified_diff6from difflib import unified_diff
7from unittest import TestLoader7import operator
8from textwrap import dedent8from textwrap import dedent
9import transaction9import transaction
10from unittest import TestLoader
1011
11from zope.security.proxy import removeSecurityProxy12from zope.security.proxy import removeSecurityProxy
1213
@@ -339,7 +340,8 @@
339 job, subscriber = self.makeProposalUpdatedEmailJob()340 job, subscriber = self.makeProposalUpdatedEmailJob()
340 pop_notifications()341 pop_notifications()
341 job.run()342 job.run()
342 emails = pop_notifications()343 emails = pop_notifications(
344 sort_key=operator.itemgetter('x-launchpad-message-rationale'))
343 self.assertEqual(3, len(emails),345 self.assertEqual(3, len(emails),
344 'There should be three emails sent out. One to the '346 'There should be three emails sent out. One to the '
345 'explicit subscriber above, and one each to the '347 'explicit subscriber above, and one each to the '
@@ -349,7 +351,7 @@
349 self.assertEqual('[Merge] '351 self.assertEqual('[Merge] '
350 'lp://dev/~bob/super-product/fix-foo-for-bar into\n\t'352 'lp://dev/~bob/super-product/fix-foo-for-bar into\n\t'
351 'lp://dev/~mary/super-product/bar', email['subject'])353 'lp://dev/~mary/super-product/bar', email['subject'])
352 self.assertEqual(dedent("""\354 expected = dedent("""\
353 The proposal to merge lp://dev/~bob/super-product/fix-foo-for-bar into lp://dev/~mary/super-product/bar has been updated.355 The proposal to merge lp://dev/~bob/super-product/fix-foo-for-bar into lp://dev/~mary/super-product/bar has been updated.
354356
355 Status: Work in progress => Needs review357 Status: Work in progress => Needs review
@@ -363,9 +365,9 @@
363 change description365 change description
364 --\x20366 --\x20
365 %s367 %s
366 You are subscribed to branch lp://dev/~bob/super-product/fix-foo-for-bar.368 You are the owner of lp://dev/~bob/super-product/fix-foo-for-bar.
367 """) % canonical_url(job.branch_merge_proposal),369 """) % canonical_url(job.branch_merge_proposal)
368 email.get_payload(decode=True))370 self.assertEqual(expected, email.get_payload(decode=True))
369371
370 def assertRecipientsMatches(self, recipients, mailer):372 def assertRecipientsMatches(self, recipients, mailer):
371 """Assert that `mailer` will send to the people in `recipients`."""373 """Assert that `mailer` will send to the people in `recipients`."""
@@ -468,8 +470,7 @@
468 review_request_job = self.getReviewNotificationEmail()470 review_request_job = self.getReviewNotificationEmail()
469 review_request_job.run()471 review_request_job.run()
470 [sent_mail] = pop_notifications()472 [sent_mail] = pop_notifications()
471 self.assertEqual(473 expected = dedent("""\
472 dedent("""\
473 You have been requested to review the proposed merge of %(source)s into %(target)s.474 You have been requested to review the proposed merge of %(source)s into %(target)s.
474475
475 This branch is awesome.476 This branch is awesome.
@@ -480,8 +481,8 @@
480 """ % {481 """ % {
481 'source': self.bmp.source_branch.bzr_identity,482 'source': self.bmp.source_branch.bzr_identity,
482 'target': self.bmp.target_branch.bzr_identity,483 'target': self.bmp.target_branch.bzr_identity,
483 'bmp': canonical_url(self.bmp)}),484 'bmp': canonical_url(self.bmp)})
484 sent_mail.get_payload(decode=True))485 self.assertEqual(expected, sent_mail.get_payload(decode=True))
485486
486 def test_nominateReview_emails_team_address(self):487 def test_nominateReview_emails_team_address(self):
487 # If a review request is made for a team, the members of the team are488 # If a review request is made for a team, the members of the team are
488489
=== modified file 'lib/lp/code/mail/tests/test_codehandler.py'
--- lib/lp/code/mail/tests/test_codehandler.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/mail/tests/test_codehandler.py 2010-04-07 18:05:36 +0000
@@ -27,7 +27,6 @@
27from canonical.launchpad.interfaces.mail import (27from canonical.launchpad.interfaces.mail import (
28 EmailProcessingError, IWeaklyAuthenticatedPrincipal)28 EmailProcessingError, IWeaklyAuthenticatedPrincipal)
29from canonical.launchpad.mail.handlers import mail_handlers29from canonical.launchpad.mail.handlers import mail_handlers
30from canonical.launchpad.webapp import canonical_url
31from canonical.launchpad.webapp.authorization import LaunchpadSecurityPolicy30from canonical.launchpad.webapp.authorization import LaunchpadSecurityPolicy
32from canonical.launchpad.webapp.interaction import (31from canonical.launchpad.webapp.interaction import (
33 get_current_principal, setupInteraction)32 get_current_principal, setupInteraction)
@@ -158,7 +157,7 @@
158 self.assertTrue(self.code_handler.process(157 self.assertTrue(self.code_handler.process(
159 mail, email_addr, None), "Succeeded, but didn't return True")158 mail, email_addr, None), "Succeeded, but didn't return True")
160 # if the message has not been created, this raises SQLObjectNotFound159 # if the message has not been created, this raises SQLObjectNotFound
161 message = MessageSet().get('<my-id>')160 MessageSet().get('<my-id>')
162161
163 def test_process_packagebranch(self):162 def test_process_packagebranch(self):
164 """Processing an email related to a package branch works.."""163 """Processing an email related to a package branch works.."""
@@ -407,7 +406,7 @@
407 md = self.factory.makeMergeDirective(406 md = self.factory.makeMergeDirective(
408 source_branch_url=source_branch_url, target_branch=target_branch)407 source_branch_url=source_branch_url, target_branch=target_branch)
409 submitter = self.factory.makePerson()408 submitter = self.factory.makePerson()
410 duplicate_branch = self.factory.makeProductBranch(409 self.factory.makeProductBranch(
411 product=target_branch.product, name='suffix', owner=submitter)410 product=target_branch.product, name='suffix', owner=submitter)
412 self.switchDbUser(config.create_merge_proposals.dbuser)411 self.switchDbUser(config.create_merge_proposals.dbuser)
413 mp_source, mp_target = self.code_handler._acquireBranchesForProposal(412 mp_source, mp_target = self.code_handler._acquireBranchesForProposal(
@@ -488,7 +487,6 @@
488487
489 MissingMergeDirective is raised when no merge directive is present.488 MissingMergeDirective is raised when no merge directive is present.
490 """489 """
491 md = self.factory.makeMergeDirective()
492 message = self.factory.makeSignedMessage(body='Hi!\n')490 message = self.factory.makeSignedMessage(body='Hi!\n')
493 self.switchDbUser(config.processmail.dbuser)491 self.switchDbUser(config.processmail.dbuser)
494 code_handler = CodeHandler()492 code_handler = CodeHandler()
@@ -683,10 +681,10 @@
683 self.factory.makeMergeDirectiveEmail())681 self.factory.makeMergeDirectiveEmail())
684 self.switchDbUser(config.create_merge_proposals.dbuser)682 self.switchDbUser(config.create_merge_proposals.dbuser)
685 code_handler = CodeHandler()683 code_handler = CodeHandler()
686 bmp = code_handler.processMergeProposal(message)684 code_handler.processMergeProposal(message)
687 _unused = pop_notifications()685 pop_notifications()
688 transaction.commit()686 transaction.commit()
689 _unused = code_handler.processMergeProposal(message)687 code_handler.processMergeProposal(message)
690 [notification] = pop_notifications()688 [notification] = pop_notifications()
691 self.assertEqual(689 self.assertEqual(
692 notification['Subject'], 'Error Creating Merge Proposal')690 notification['Subject'], 'Error Creating Merge Proposal')
@@ -757,8 +755,8 @@
757 """If an LP URL is provided, we attempt to reproduce it exactly."""755 """If an LP URL is provided, we attempt to reproduce it exactly."""
758 submitter = self.factory.makePerson(name='merge-submitter')756 submitter = self.factory.makePerson(name='merge-submitter')
759 target = self.makeTargetBranch()757 target = self.makeTargetBranch()
760 url_product = self.factory.makeProduct('uproduct')758 self.factory.makeProduct('uproduct')
761 url_person = self.factory.makePerson(name='uuser')759 self.factory.makePerson(name='uuser')
762 code_handler = CodeHandler()760 code_handler = CodeHandler()
763 namespace, base = code_handler._getNewBranchInfo(761 namespace, base = code_handler._getNewBranchInfo(
764 config.codehosting.supermirror_root + '~uuser/uproduct/bar',762 config.codehosting.supermirror_root + '~uuser/uproduct/bar',
@@ -770,8 +768,8 @@
770 """Trailing slashes are permitted in LP URLs."""768 """Trailing slashes are permitted in LP URLs."""
771 submitter = self.factory.makePerson(name='merge-submitter')769 submitter = self.factory.makePerson(name='merge-submitter')
772 target = self.makeTargetBranch()770 target = self.makeTargetBranch()
773 url_product = self.factory.makeProduct('uproduct')771 self.factory.makeProduct('uproduct')
774 url_person = self.factory.makePerson(name='uuser')772 self.factory.makePerson(name='uuser')
775 code_handler = CodeHandler()773 code_handler = CodeHandler()
776 namespace, base = code_handler._getNewBranchInfo(774 namespace, base = code_handler._getNewBranchInfo(
777 config.codehosting.supermirror_root + '~uuser/uproduct/bar/',775 config.codehosting.supermirror_root + '~uuser/uproduct/bar/',
@@ -812,7 +810,7 @@
812 body=' review abstain',810 body=' review abstain',
813 subject='')811 subject='')
814 bmp = self.factory.makeBranchMergeProposal()812 bmp = self.factory.makeBranchMergeProposal()
815 _unused = pop_notifications()813 pop_notifications()
816 email_addr = bmp.address814 email_addr = bmp.address
817 self.switchDbUser(config.processmail.dbuser)815 self.switchDbUser(config.processmail.dbuser)
818 self.code_handler.process(mail, email_addr, None)816 self.code_handler.process(mail, email_addr, None)
@@ -955,7 +953,7 @@
955 format="1.9")953 format="1.9")
956 bmp = self._processMergeDirective(message)954 bmp = self._processMergeDirective(message)
957 # The hosted location should be populated (open succeeds).955 # The hosted location should be populated (open succeeds).
958 source_bzr_branch = self._openBazaarBranchAsClient(bmp.source_branch)956 self._openBazaarBranchAsClient(bmp.source_branch)
959 # Not the mirror (open raises).957 # Not the mirror (open raises).
960 self.assertRaises(958 self.assertRaises(
961 bzr_errors.NotBranchError, Branch.open,959 bzr_errors.NotBranchError, Branch.open,
962960
=== modified file 'lib/lp/code/mail/tests/test_codereviewcomment.py'
--- lib/lp/code/mail/tests/test_codereviewcomment.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/mail/tests/test_codereviewcomment.py 2010-04-07 18:05:36 +0000
@@ -18,7 +18,7 @@
18 BranchSubscriptionNotificationLevel, CodeReviewNotificationLevel,18 BranchSubscriptionNotificationLevel, CodeReviewNotificationLevel,
19 CodeReviewVote)19 CodeReviewVote)
20from lp.code.mail.codereviewcomment import CodeReviewCommentMailer20from lp.code.mail.codereviewcomment import CodeReviewCommentMailer
21from lp.testing import ANONYMOUS, login, login_person, TestCaseWithFactory21from lp.testing import login, login_person, TestCaseWithFactory
2222
2323
24class TestCodeReviewComment(TestCaseWithFactory):24class TestCodeReviewComment(TestCaseWithFactory):
2525
=== modified file 'lib/lp/code/model/branchmergeproposal.py'
--- lib/lp/code/model/branchmergeproposal.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/model/branchmergeproposal.py 2010-04-07 18:05:36 +0000
@@ -141,21 +141,18 @@
141 def next_preview_diff_job(self):141 def next_preview_diff_job(self):
142 # circular dependencies142 # circular dependencies
143 from lp.code.model.branchmergeproposaljob import (143 from lp.code.model.branchmergeproposaljob import (
144 BranchMergeProposalJob, MergeProposalCreatedJob,144 BranchMergeProposalJob, BranchMergeProposalJobFactory,
145 UpdatePreviewDiffJob)145 BranchMergeProposalJobType)
146 job_classes = [MergeProposalCreatedJob, UpdatePreviewDiffJob]
147 type_classes = dict(
148 (job_class.class_job_type, job_class)
149 for job_class in job_classes)
150 job = Store.of(self).find(146 job = Store.of(self).find(
151 BranchMergeProposalJob,147 BranchMergeProposalJob,
152 BranchMergeProposalJob.branch_merge_proposal == self,148 BranchMergeProposalJob.branch_merge_proposal == self,
153 BranchMergeProposalJob.job_type.is_in(type_classes.keys()),149 BranchMergeProposalJob.job_type ==
150 BranchMergeProposalJobType.UPDATE_PREVIEW_DIFF,
154 BranchMergeProposalJob.job == Job.id,151 BranchMergeProposalJob.job == Job.id,
155 Job._status.is_in([JobStatus.WAITING, JobStatus.RUNNING])152 Job._status.is_in([JobStatus.WAITING, JobStatus.RUNNING])
156 ).order_by(Job.scheduled_start, Job.date_created).first()153 ).order_by(Job.scheduled_start, Job.date_created).first()
157 if job is not None:154 if job is not None:
158 return type_classes[job.job_type](job)155 return BranchMergeProposalJobFactory.create(job)
159 else:156 else:
160 return None157 return None
161158
@@ -620,7 +617,7 @@
620 message = Message(617 message = Message(
621 parent=parent_message, owner=owner, rfc822msgid=msgid,618 parent=parent_message, owner=owner, rfc822msgid=msgid,
622 subject=subject, datecreated=_date_created)619 subject=subject, datecreated=_date_created)
623 chunk = MessageChunk(message=message, content=content, sequence=1)620 MessageChunk(message=message, content=content, sequence=1)
624 return self.createCommentFromMessage(621 return self.createCommentFromMessage(
625 message, vote, review_type, original_email=None,622 message, vote, review_type, original_email=None,
626 _notify_listeners=_notify_listeners, _validate=False)623 _notify_listeners=_notify_listeners, _validate=False)
627624
=== modified file 'lib/lp/code/model/branchmergeproposaljob.py'
--- lib/lp/code/model/branchmergeproposaljob.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/model/branchmergeproposaljob.py 2010-04-07 18:05:36 +0000
@@ -17,7 +17,9 @@
1717
18__all__ = [18__all__ = [
19 'BranchMergeProposalJob',19 'BranchMergeProposalJob',
20 'BranchMergeProposalJobFactory',
20 'BranchMergeProposalJobSource',21 'BranchMergeProposalJobSource',
22 'BranchMergeProposalJobType',
21 'CodeReviewCommentEmailJob',23 'CodeReviewCommentEmailJob',
22 'CreateMergeProposalJob',24 'CreateMergeProposalJob',
23 'MergeProposalCreatedJob',25 'MergeProposalCreatedJob',
2426
=== modified file 'lib/lp/code/model/tests/test_branchcloud.py'
--- lib/lp/code/model/tests/test_branchcloud.py 2009-06-30 16:56:07 +0000
+++ lib/lp/code/model/tests/test_branchcloud.py 2010-04-07 18:05:36 +0000
@@ -55,9 +55,10 @@
55 date_generator = time_counter(start_date, delta)55 date_generator = time_counter(start_date, delta)
56 branch = self.factory.makeProductBranch(56 branch = self.factory.makeProductBranch(
57 product=product, branch_type=branch_type, private=private)57 product=product, branch_type=branch_type, private=private)
58 self.factory.makeRevisionsForBranch(58 if branch_type != BranchType.REMOTE:
59 removeSecurityProxy(branch), count=revision_count,59 self.factory.makeRevisionsForBranch(
60 date_generator=date_generator)60 removeSecurityProxy(branch), count=revision_count,
61 date_generator=date_generator)
61 return branch62 return branch
6263
63 def test_empty_with_no_branches(self):64 def test_empty_with_no_branches(self):
6465
=== modified file 'lib/lp/code/model/tests/test_branchmergeproposaljobs.py'
--- lib/lp/code/model/tests/test_branchmergeproposaljobs.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposaljobs.py 2010-04-07 18:05:36 +0000
@@ -87,33 +87,6 @@
87 verifyObject(IMergeProposalCreatedJob, job)87 verifyObject(IMergeProposalCreatedJob, job)
88 verifyObject(IBranchMergeProposalJob, job)88 verifyObject(IBranchMergeProposalJob, job)
8989
90 def test_run_makes_diff(self):
91 """MergeProposalCreationJob.run creates a diff."""
92 self.useBzrBranches()
93 target, target_tree = self.create_branch_and_tree('target')
94 target_tree.bzrdir.root_transport.put_bytes('foo', 'foo\n')
95 target_tree.add('foo')
96 rev1 = target_tree.commit('added foo')
97 source, source_tree = self.create_branch_and_tree('source')
98 source_tree.pull(target_tree.branch, stop_revision=rev1)
99 source_tree.bzrdir.root_transport.put_bytes('foo', 'foo\nbar\n')
100 source_tree.commit('added bar')
101 target_tree.merge_from_branch(source_tree.branch)
102 target_tree.commit('merged from source')
103 source_tree.bzrdir.root_transport.put_bytes('foo', 'foo\nbar\nqux\n')
104 source_tree.commit('added qux')
105 bmp = self.factory.makeBranchMergeProposal(
106 source_branch=source, target_branch=target,
107 registrant=source.owner)
108 job = MergeProposalCreatedJob.create(bmp)
109 transaction.commit()
110 self.layer.switchDbUser(config.merge_proposal_jobs.dbuser)
111 job.run()
112 self.assertIs(None, bmp.review_diff)
113 self.assertIsNot(None, bmp.preview_diff)
114 transaction.commit()
115 self.checkDiff(bmp.preview_diff)
116
117 def checkDiff(self, diff):90 def checkDiff(self, diff):
118 self.assertNotIn('+bar', diff.diff.text)91 self.assertNotIn('+bar', diff.diff.text)
119 self.assertIn('+qux', diff.diff.text)92 self.assertIn('+qux', diff.diff.text)
@@ -174,12 +147,12 @@
174 def test_run(self):147 def test_run(self):
175 self.useBzrBranches()148 self.useBzrBranches()
176 bmp = self.createExampleMerge()[0]149 bmp = self.createExampleMerge()[0]
177 UpdatePreviewDiffJob.create(bmp)150 job = UpdatePreviewDiffJob.create(bmp)
178 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)151 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)
179 bmp.source_branch.next_mirror_time = None152 bmp.source_branch.next_mirror_time = None
180 transaction.commit()153 transaction.commit()
181 self.layer.switchDbUser(config.merge_proposal_jobs.dbuser)154 self.layer.switchDbUser(config.merge_proposal_jobs.dbuser)
182 JobRunner.fromReady(UpdatePreviewDiffJob).runAll()155 JobRunner([job]).runAll()
183 transaction.commit()156 transaction.commit()
184 self.checkExampleMerge(bmp.preview_diff.text)157 self.checkExampleMerge(bmp.preview_diff.text)
185158
@@ -205,6 +178,14 @@
205 'The source branch has no revisions.',178 'The source branch has no revisions.',
206 email.get_payload(decode=True))179 email.get_payload(decode=True))
207180
181 def test_10_minute_lease(self):
182 self.useBzrBranches()
183 bmp = self.createExampleMerge()[0]
184 job = UpdatePreviewDiffJob.create(bmp)
185 job.acquireLease()
186 expiry_delta = job.lease_expires - datetime.now(pytz.UTC)
187 self.assertTrue(500 <= expiry_delta.seconds, expiry_delta)
188
208189
209class TestBranchMergeProposalJobSource(TestCaseWithFactory):190class TestBranchMergeProposalJobSource(TestCaseWithFactory):
210191
211192
=== modified file 'lib/lp/code/model/tests/test_branchmergeproposals.py'
--- lib/lp/code/model/tests/test_branchmergeproposals.py 2010-04-07 18:05:11 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposals.py 2010-04-07 18:05:36 +0000
@@ -49,13 +49,7 @@
49 BranchMergeProposalGetter, is_valid_transition)49 BranchMergeProposalGetter, is_valid_transition)
50from lp.registry.interfaces.person import IPersonSet50from lp.registry.interfaces.person import IPersonSet
51from lp.registry.interfaces.product import IProductSet51from lp.registry.interfaces.product import IProductSet
52<<<<<<< TREE
53from lp.services.job.runner import JobRunner
54from lp.testing import (
55 capture_events, login_person, TestCaseWithFactory)
56=======
57from lp.testing import login_person, TestCaseWithFactory52from lp.testing import login_person, TestCaseWithFactory
58>>>>>>> MERGE-SOURCE
59from lp.testing.factory import GPGSigningContext, LaunchpadObjectFactory53from lp.testing.factory import GPGSigningContext, LaunchpadObjectFactory
6054
6155
@@ -176,7 +170,7 @@
176 proposal.superseded_by.rejectBranch(self.target_branch.owner,170 proposal.superseded_by.rejectBranch(self.target_branch.owner,
177 None)171 None)
178 self.assertProposalState(proposal, from_state)172 self.assertProposalState(proposal, from_state)
179 dupe = self.factory.makeBranchMergeProposal(173 self.factory.makeBranchMergeProposal(
180 target_branch=proposal.target_branch,174 target_branch=proposal.target_branch,
181 source_branch=proposal.source_branch)175 source_branch=proposal.source_branch)
182 return proposal176 return proposal
@@ -972,11 +966,10 @@
972 # participant.966 # participant.
973 wally = self.factory.makePerson(name='wally')967 wally = self.factory.makePerson(name='wally')
974 beaver = self.factory.makePerson(name='beaver')968 beaver = self.factory.makePerson(name='beaver')
975 name12 = getUtility(IPersonSet).getByName('name12')
976969
977 bmp1 = self._make_merge_proposal('wally', 'gokart', 'turbo', True)970 bmp1 = self._make_merge_proposal('wally', 'gokart', 'turbo', True)
978 bmp1.nominateReviewer(beaver, wally)971 bmp1.nominateReviewer(beaver, wally)
979 bmp2 = self._make_merge_proposal('beaver', 'gokart', 'brakes', True)972 self._make_merge_proposal('beaver', 'gokart', 'brakes', True)
980973
981 getter = BranchMergeProposalGetter974 getter = BranchMergeProposalGetter
982 wally_proposals = getter.getProposalsForParticipant(975 wally_proposals = getter.getProposalsForParticipant(
@@ -1030,8 +1023,8 @@
10301023
1031 def test_wip_for_product_restrictions(self):1024 def test_wip_for_product_restrictions(self):
1032 # Check queries on product limited on status.1025 # Check queries on product limited on status.
1033 in_progress = self._make_merge_proposal('albert', 'november', 'work')1026 self._make_merge_proposal('albert', 'november', 'work')
1034 needs_review = self._make_merge_proposal(1027 self._make_merge_proposal(
1035 'bob', 'november', 'work', needs_review=True)1028 'bob', 'november', 'work', needs_review=True)
1036 self.assertEqual(1029 self.assertEqual(
1037 ['~albert/november/work'],1030 ['~albert/november/work'],
@@ -1386,7 +1379,7 @@
1386 """A comment with a vote creates a vote reference."""1379 """A comment with a vote creates a vote reference."""
1387 merge_proposal = self.factory.makeBranchMergeProposal()1380 merge_proposal = self.factory.makeBranchMergeProposal()
1388 reviewer = self.factory.makePerson()1381 reviewer = self.factory.makePerson()
1389 comment = merge_proposal.createComment(1382 merge_proposal.createComment(
1390 reviewer, 'Message subject', 'Message content')1383 reviewer, 'Message subject', 'Message content')
1391 self.assertEqual([], list(merge_proposal.votes))1384 self.assertEqual([], list(merge_proposal.votes))
13921385
@@ -1394,7 +1387,7 @@
1394 """A second vote changes the comment reference only."""1387 """A second vote changes the comment reference only."""
1395 merge_proposal = self.factory.makeBranchMergeProposal()1388 merge_proposal = self.factory.makeBranchMergeProposal()
1396 reviewer = self.factory.makePerson()1389 reviewer = self.factory.makePerson()
1397 comment1 = merge_proposal.createComment(1390 merge_proposal.createComment(
1398 reviewer, 'Message subject', 'Message content',1391 reviewer, 'Message subject', 'Message content',
1399 vote=CodeReviewVote.DISAPPROVE)1392 vote=CodeReviewVote.DISAPPROVE)
1400 comment2 = merge_proposal.createComment(1393 comment2 = merge_proposal.createComment(
@@ -1635,50 +1628,10 @@
1635 removeSecurityProxy(merge_proposal.preview_diff).diff_id)1628 removeSecurityProxy(merge_proposal.preview_diff).diff_id)
16361629
16371630
1638<<<<<<< TREE
1639class TestUpdatePreviewDiffJob(DiffTestCase):
1640
1641 layer = LaunchpadZopelessLayer
1642
1643 def test_implement_interface(self):
1644 """UpdatePreviewDiffJob implements IUpdatePreviewDiffJobSource."""
1645 verifyObject(IUpdatePreviewDiffJobSource, UpdatePreviewDiffJob)
1646
1647 def test_run(self):
1648 self.useBzrBranches()
1649 bmp = self.createExampleMerge()[0]
1650 job = UpdatePreviewDiffJob.create(bmp)
1651 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)
1652 bmp.source_branch.next_mirror_time = None
1653 transaction.commit()
1654 self.layer.switchDbUser(config.update_preview_diffs.dbuser)
1655 JobRunner.fromReady(UpdatePreviewDiffJob).runAll()
1656 transaction.commit()
1657 self.checkExampleMerge(bmp.preview_diff.text)
1658
1659 def test_10_minute_lease(self):
1660 self.useBzrBranches()
1661 bmp = self.createExampleMerge()[0]
1662 job = UpdatePreviewDiffJob.create(bmp)
1663 job.acquireLease()
1664 expiry_delta = job.lease_expires - datetime.now(UTC)
1665 self.assertTrue(500 <= expiry_delta.seconds, expiry_delta)
1666
1667
1668=======
1669>>>>>>> MERGE-SOURCE
1670class TestNextPreviewDiffJob(TestCaseWithFactory):1631class TestNextPreviewDiffJob(TestCaseWithFactory):
16711632
1672 layer = DatabaseFunctionalLayer1633 layer = DatabaseFunctionalLayer
16731634
1674 def test_returns_bmp_job(self):
1675 """For new proposals, get the MergeProposalCreatedJob."""
1676 bmp = self.factory.makeBranchMergeProposal()
1677 job = bmp.next_preview_diff_job
1678 self.assertEqual(bmp, job.branch_merge_proposal)
1679 self.assertIs(
1680 MergeProposalCreatedJob, removeSecurityProxy(job).__class__)
1681
1682 def test_returns_none_if_job_not_pending(self):1635 def test_returns_none_if_job_not_pending(self):
1683 """Jobs are shown while pending."""1636 """Jobs are shown while pending."""
1684 bmp = self.factory.makeBranchMergeProposal()1637 bmp = self.factory.makeBranchMergeProposal()
@@ -1702,11 +1655,11 @@
1702 Store.of(updatejob.context).flush()1655 Store.of(updatejob.context).flush()
1703 self.assertEqual(updatejob, bmp.next_preview_diff_job)1656 self.assertEqual(updatejob, bmp.next_preview_diff_job)
17041657
1705 def test_returns_first__job(self):1658 def test_returns_first_job(self):
1706 """First-created job is returned."""1659 """First-created job is returned."""
1707 bmp = self.makeBranchMergeProposalNoPending()1660 bmp = self.makeBranchMergeProposalNoPending()
1708 updatejob = UpdatePreviewDiffJob.create(bmp)1661 updatejob = UpdatePreviewDiffJob.create(bmp)
1709 updatejob2 = UpdatePreviewDiffJob.create(bmp)1662 UpdatePreviewDiffJob.create(bmp)
1710 self.assertEqual(updatejob, bmp.next_preview_diff_job)1663 self.assertEqual(updatejob, bmp.next_preview_diff_job)
17111664
1712 def test_does_not_return_jobs_for_other_proposals(self):1665 def test_does_not_return_jobs_for_other_proposals(self):
@@ -1714,7 +1667,7 @@
1714 bmp = self.factory.makeBranchMergeProposal()1667 bmp = self.factory.makeBranchMergeProposal()
1715 bmp.next_preview_diff_job.start()1668 bmp.next_preview_diff_job.start()
1716 bmp.next_preview_diff_job.complete()1669 bmp.next_preview_diff_job.complete()
1717 bmp2 = self.factory.makeBranchMergeProposal()1670 self.factory.makeBranchMergeProposal()
1718 self.assertIs(None, bmp.next_preview_diff_job)1671 self.assertIs(None, bmp.next_preview_diff_job)
17191672
17201673
17211674
=== modified file 'lib/lp/code/model/tests/test_diff.py'
--- lib/lp/code/model/tests/test_diff.py 2010-02-17 19:10:51 +0000
+++ lib/lp/code/model/tests/test_diff.py 2010-04-07 18:05:36 +0000
@@ -55,6 +55,10 @@
55 """Create a merge proposal with conflicts and updates."""55 """Create a merge proposal with conflicts and updates."""
56 self.useBzrBranches()56 self.useBzrBranches()
57 bmp = self.factory.makeBranchMergeProposal()57 bmp = self.factory.makeBranchMergeProposal()
58 # Make the branches of the merge proposal look good as far as the
59 # model is concerned.
60 self.factory.makeRevisionsForBranch(bmp.source_branch)
61 self.factory.makeRevisionsForBranch(bmp.target_branch)
58 bzr_target = self.createBzrBranch(bmp.target_branch)62 bzr_target = self.createBzrBranch(bmp.target_branch)
59 self.commitFile(bmp.target_branch, 'foo', 'a\n')63 self.commitFile(bmp.target_branch, 'foo', 'a\n')
60 self.createBzrBranch(bmp.source_branch, bzr_target)64 self.createBzrBranch(bmp.source_branch, bzr_target)
6165
=== modified file 'lib/lp/code/scripts/tests/test_create_merge_proposals.py'
--- lib/lp/code/scripts/tests/test_create_merge_proposals.py 2009-10-17 14:06:03 +0000
+++ lib/lp/code/scripts/tests/test_create_merge_proposals.py 2010-04-07 18:05:36 +0000
@@ -40,7 +40,7 @@
40 'cronscripts/create_merge_proposals.py', [])40 'cronscripts/create_merge_proposals.py', [])
41 self.assertEqual(0, retcode)41 self.assertEqual(0, retcode)
42 self.assertEqual(42 self.assertEqual(
43 'INFO creating lockfile\n'43 'INFO Creating lockfile: /var/lock/launchpad-create_merge_proposals.lock\n'
44 'INFO Ran 1 CreateMergeProposalJobs.\n', stderr)44 'INFO Ran 1 CreateMergeProposalJobs.\n', stderr)
45 self.assertEqual('', stdout)45 self.assertEqual('', stdout)
46 self.assertEqual(1, source.landing_targets.count())46 self.assertEqual(1, source.landing_targets.count())
@@ -67,7 +67,7 @@
67 'cronscripts/create_merge_proposals.py', [])67 'cronscripts/create_merge_proposals.py', [])
68 self.assertEqual(0, retcode)68 self.assertEqual(0, retcode)
69 self.assertEqual(69 self.assertEqual(
70 'INFO creating lockfile\n'70 'INFO Creating lockfile: /var/lock/launchpad-create_merge_proposals.lock\n'
71 'INFO Ran 1 CreateMergeProposalJobs.\n', stderr)71 'INFO Ran 1 CreateMergeProposalJobs.\n', stderr)
72 self.assertEqual('', stdout)72 self.assertEqual('', stdout)
73 # The hosted location should be populated, not the mirror.73 # The hosted location should be populated, not the mirror.
@@ -106,7 +106,7 @@
106 transaction.commit()106 transaction.commit()
107 retcode, stdout, stderr = run_script(107 retcode, stdout, stderr = run_script(
108 'cronscripts/create_merge_proposals.py', [])108 'cronscripts/create_merge_proposals.py', [])
109 self.assertIn('INFO creating lockfile\n', stderr)109 self.assertIn('INFO Creating lockfile:', stderr)
110 self.assertIn('INFO Job resulted in OOPS:', stderr)110 self.assertIn('INFO Job resulted in OOPS:', stderr)
111 self.assertIn('INFO Ran 0 CreateMergeProposalJobs.\n', stderr)111 self.assertIn('INFO Ran 0 CreateMergeProposalJobs.\n', stderr)
112 self.assertEqual('', stdout)112 self.assertEqual('', stdout)
113113
=== renamed file 'lib/lp/code/scripts/tests/test_mp_creationjob.py' => 'lib/lp/code/scripts/tests/test_merge_proposal_jobs.py'
--- lib/lp/code/scripts/tests/test_mp_creationjob.py 2010-01-06 14:41:45 +0000
+++ lib/lp/code/scripts/tests/test_merge_proposal_jobs.py 2010-04-07 18:05:36 +0000
@@ -6,64 +6,26 @@
6"""Test the sendbranchmail script"""6"""Test the sendbranchmail script"""
77
8import unittest8import unittest
9import transaction
109
11from canonical.testing import ZopelessAppServerLayer10from canonical.testing import ZopelessAppServerLayer
12from lp.testing import TestCaseWithFactory11from lp.testing import TestCaseWithFactory
13from canonical.launchpad.scripts.tests import run_script12from canonical.launchpad.scripts.tests import run_script
14from lp.code.model.branchmergeproposal import BranchMergeProposal13
15from lp.code.model.branchmergeproposaljob import MergeProposalCreatedJob14
1615class TestMergeProposalJobScript(TestCaseWithFactory):
17
18class TestDiffBMPs(TestCaseWithFactory):
1916
20 layer = ZopelessAppServerLayer17 layer = ZopelessAppServerLayer
2118
22 def test_mpcreationjobs(self):19 def test_script_runs(self):
23 """Ensure mpcreationjobs runs and generates diffs."""20 """Ensure merge-proposal-jobs script runs."""
24 self.useTempBzrHome()
25 target, target_tree = self.createMirroredBranchAndTree()
26 target_tree.bzrdir.root_transport.put_bytes('foo', 'foo\n')
27 target_tree.add('foo')
28 target_tree.commit('added foo')
29 target.linkBug(self.factory.makeBug(), target.registrant)
30 source, source_tree = self.createMirroredBranchAndTree()
31 source_tree.pull(target_tree.branch)
32 source_tree.bzrdir.root_transport.put_bytes('foo', 'foo\nbar\n')
33 source_tree.commit('added bar')
34 # Add a fake revisions so the proposal is ready.
35 self.factory.makeRevisionsForBranch(source, count=1)
36 source.linkBug(self.factory.makeBug(), source.registrant)
37 bmp = BranchMergeProposal(
38 source_branch=source, target_branch=target,
39 registrant=source.owner)
40 job = MergeProposalCreatedJob.create(bmp)
41 self.assertIs(None, bmp.preview_diff)
42 transaction.commit()
43 retcode, stdout, stderr = run_script(21 retcode, stdout, stderr = run_script(
44 'cronscripts/mpcreationjobs.py', [])22 'cronscripts/merge-proposal-jobs.py', [])
45 self.assertEqual(0, retcode)23 self.assertEqual(0, retcode)
46 self.assertEqual('', stdout)24 self.assertEqual('', stdout)
47 self.assertEqual(25 self.assertEqual(
48 'INFO creating lockfile\n'26 'INFO Creating lockfile:'
49 'INFO Ran 1 MergeProposalCreatedJobs.\n', stderr)27 ' /var/lock/launchpad-merge-proposal-jobs.lock\n'
50 self.assertIs(None, bmp.review_diff)28 'INFO Running through Twisted.\n', stderr)
51 self.assertIsNot(None, bmp.preview_diff)
52
53 def test_mpcreationjobs_records_oops(self):
54 """Ensure mpcreationjobs logs an oops if the job fails."""
55 bmp = self.factory.makeBranchMergeProposal()
56 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)
57 job = MergeProposalCreatedJob.create(bmp)
58 transaction.commit()
59 retcode, stdout, stderr = run_script(
60 'cronscripts/mpcreationjobs.py', [])
61 self.assertEqual(0, retcode)
62 self.assertEqual('', stdout)
63 self.assertIn(
64 'INFO Ran 0 MergeProposalCreatedJobs.\n', stderr)
65 self.assertIn(
66 'INFO Job resulted in OOPS:', stderr)
6729
68def test_suite():30def test_suite():
69 return unittest.TestLoader().loadTestsFromName(__name__)31 return unittest.TestLoader().loadTestsFromName(__name__)
7032
=== modified file 'lib/lp/code/scripts/tests/test_reclaim_branch_space.py'
--- lib/lp/code/scripts/tests/test_reclaim_branch_space.py 2009-09-03 20:53:32 +0000
+++ lib/lp/code/scripts/tests/test_reclaim_branch_space.py 2010-04-07 18:05:36 +0000
@@ -43,7 +43,7 @@
43 'cronscripts/reclaimbranchspace.py', [])43 'cronscripts/reclaimbranchspace.py', [])
44 self.assertEqual('', stdout)44 self.assertEqual('', stdout)
45 self.assertEqual(45 self.assertEqual(
46 'INFO creating lockfile\n'46 'INFO Creating lockfile: /var/lock/launchpad-reclaimbranchspace.lock\n'
47 'INFO Reclaimed space for 0 branches.\n', stderr)47 'INFO Reclaimed space for 0 branches.\n', stderr)
48 self.assertEqual(0, retcode)48 self.assertEqual(0, retcode)
49 self.assertTrue(49 self.assertTrue(
@@ -61,7 +61,7 @@
61 'cronscripts/reclaimbranchspace.py', [])61 'cronscripts/reclaimbranchspace.py', [])
62 self.assertEqual('', stdout)62 self.assertEqual('', stdout)
63 self.assertEqual(63 self.assertEqual(
64 'INFO creating lockfile\n'64 'INFO Creating lockfile: /var/lock/launchpad-reclaimbranchspace.lock\n'
65 'INFO Reclaimed space for 1 branches.\n', stderr)65 'INFO Reclaimed space for 1 branches.\n', stderr)
66 self.assertEqual(0, retcode)66 self.assertEqual(0, retcode)
67 self.assertFalse(67 self.assertFalse(
@@ -91,8 +91,7 @@
91 # The script will now remove the branch from disk.91 # The script will now remove the branch from disk.
92 retcode, stdout, stderr = run_script(92 retcode, stdout, stderr = run_script(
93 'cronscripts/reclaimbranchspace.py', [])93 'cronscripts/reclaimbranchspace.py', [])
94 self.assertEqual('', stdout)94 self.assertIn('INFO Creating lockfile: ', stderr)
95 self.assertIn('INFO creating lockfile\n', stderr)
96 self.assertIn('INFO Job resulted in OOPS:', stderr)95 self.assertIn('INFO Job resulted in OOPS:', stderr)
97 self.assertIn('INFO Reclaimed space for 0 branches.\n', stderr)96 self.assertIn('INFO Reclaimed space for 0 branches.\n', stderr)
9897
9998
=== modified file 'lib/lp/code/scripts/tests/test_scan_branches.py'
--- lib/lp/code/scripts/tests/test_scan_branches.py 2010-01-29 19:15:05 +0000
+++ lib/lp/code/scripts/tests/test_scan_branches.py 2010-04-07 18:05:36 +0000
@@ -31,7 +31,7 @@
31 target_tree.commit('First commit', rev_id='rev1')31 target_tree.commit('First commit', rev_id='rev1')
32 target_tree.commit('Second commit', rev_id='rev2')32 target_tree.commit('Second commit', rev_id='rev2')
33 target_tree.commit('Third commit', rev_id='rev3')33 target_tree.commit('Third commit', rev_id='rev3')
34 job = BranchScanJob.create(db_branch)34 BranchScanJob.create(db_branch)
35 transaction.commit()35 transaction.commit()
3636
37 def run_script_and_assert_success(self):37 def run_script_and_assert_success(self):
@@ -41,7 +41,7 @@
41 expect_returncode=0)41 expect_returncode=0)
42 self.assertEqual('', stdout)42 self.assertEqual('', stdout)
43 self.assertIn(43 self.assertIn(
44 'INFO Ran 1 IBranchScanJobSource jobs.\n', stderr)44 'INFO Ran 1 BranchScanJob jobs.\n', stderr)
4545
46 def test_scan_branch(self):46 def test_scan_branch(self):
47 """Test that scan branches adds revisions to the database."""47 """Test that scan branches adds revisions to the database."""
4848
=== modified file 'lib/lp/code/scripts/tests/test_sendbranchmail.py'
--- lib/lp/code/scripts/tests/test_sendbranchmail.py 2009-10-17 14:06:03 +0000
+++ lib/lp/code/scripts/tests/test_sendbranchmail.py 2010-04-07 18:05:36 +0000
@@ -38,13 +38,14 @@
38 """Ensure sendbranchmail runs and sends email."""38 """Ensure sendbranchmail runs and sends email."""
39 self.useTempBzrHome()39 self.useTempBzrHome()
40 branch, tree = self.createBranch()40 branch, tree = self.createBranch()
41 job_1 = RevisionMailJob.create(41 RevisionMailJob.create(
42 branch, 1, 'from@example.org', 'body', True, 'foo')42 branch, 1, 'from@example.org', 'body', True, 'foo')
43 transaction.commit()43 transaction.commit()
44 retcode, stdout, stderr = run_script(44 retcode, stdout, stderr = run_script(
45 'cronscripts/sendbranchmail.py', [])45 'cronscripts/sendbranchmail.py', [])
46 self.assertEqual('INFO creating lockfile\n'46 self.assertEqual(
47 'INFO Ran 1 RevisionMailJobs.\n', stderr)47 'INFO Creating lockfile: /var/lock/launchpad-sendbranchmail.lock\n'
48 'INFO Ran 1 RevisionMailJobs.\n', stderr)
48 self.assertEqual('', stdout)49 self.assertEqual('', stdout)
49 self.assertEqual(0, retcode)50 self.assertEqual(0, retcode)
5051
@@ -52,12 +53,14 @@
52 """Ensure sendbranchmail runs and sends email."""53 """Ensure sendbranchmail runs and sends email."""
53 self.useTempBzrHome()54 self.useTempBzrHome()
54 branch = self.factory.makeBranch()55 branch = self.factory.makeBranch()
55 job_1 = RevisionMailJob.create(56 RevisionMailJob.create(
56 branch, 1, 'from@example.org', 'body', True, 'foo')57 branch, 1, 'from@example.org', 'body', True, 'foo')
57 transaction.commit()58 transaction.commit()
58 retcode, stdout, stderr = run_script(59 retcode, stdout, stderr = run_script(
59 'cronscripts/sendbranchmail.py', [])60 'cronscripts/sendbranchmail.py', [])
60 self.assertIn('INFO creating lockfile\n', stderr)61 self.assertIn(
62 'INFO Creating lockfile: /var/lock/launchpad-sendbranchmail.lock\n',
63 stderr)
61 self.assertIn('INFO Job resulted in OOPS:', stderr)64 self.assertIn('INFO Job resulted in OOPS:', stderr)
62 self.assertIn('INFO Ran 0 RevisionMailJobs.\n', stderr)65 self.assertIn('INFO Ran 0 RevisionMailJobs.\n', stderr)
63 self.assertEqual('', stdout)66 self.assertEqual('', stdout)
@@ -69,13 +72,15 @@
69 branch, tree = self.createBranch()72 branch, tree = self.createBranch()
70 tree.bzrdir.root_transport.put_bytes('foo', 'baz')73 tree.bzrdir.root_transport.put_bytes('foo', 'baz')
71 tree.commit('Added foo.', rev_id='rev2')74 tree.commit('Added foo.', rev_id='rev2')
72 job_1 = RevisionsAddedJob.create(75 RevisionsAddedJob.create(
73 branch, 'rev1', 'rev2', 'from@example.org')76 branch, 'rev1', 'rev2', 'from@example.org')
74 transaction.commit()77 transaction.commit()
75 retcode, stdout, stderr = run_script(78 retcode, stdout, stderr = run_script(
76 'cronscripts/sendbranchmail.py', [])79 'cronscripts/sendbranchmail.py', [])
77 self.assertEqual('INFO creating lockfile\n'80 self.assertEqual(
78 'INFO Ran 1 RevisionMailJobs.\n', stderr)81 'INFO Creating lockfile: /var/lock/launchpad-sendbranchmail.lock\n'
82 'INFO Ran 1 RevisionMailJobs.\n',
83 stderr)
79 self.assertEqual('', stdout)84 self.assertEqual('', stdout)
80 self.assertEqual(0, retcode)85 self.assertEqual(0, retcode)
8186
8287
=== removed file 'lib/lp/code/scripts/tests/test_update_preview_diffs.py'
--- lib/lp/code/scripts/tests/test_update_preview_diffs.py 2010-01-05 20:37:10 +0000
+++ lib/lp/code/scripts/tests/test_update_preview_diffs.py 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
1#! /usr/bin/python2.5
2#
3# Copyright 2009 Canonical Ltd. This software is licensed under the
4# GNU Affero General Public License version 3 (see the file LICENSE).
5
6"""Test the update_preview_diffs script."""
7
8
9import transaction
10
11from canonical.testing import ZopelessAppServerLayer
12from lp.testing import TestCaseWithFactory
13from canonical.launchpad.scripts.tests import run_script
14from canonical.launchpad.webapp import errorlog
15from lp.code.model.branchmergeproposal import BranchMergeProposal
16from lp.code.model.branchmergeproposaljob import UpdatePreviewDiffJob
17
18
19class TestUpdatePreviewDiffs(TestCaseWithFactory):
20
21 layer = ZopelessAppServerLayer
22
23 def create_preview_diff_job(self):
24 self.useTempBzrHome()
25 target, target_tree = self.createMirroredBranchAndTree()
26 target_tree.bzrdir.root_transport.put_bytes('foo', 'foo\n')
27 target_tree.add('foo')
28 target_tree.commit('added foo')
29 source, source_tree = self.createMirroredBranchAndTree()
30 source_tree.pull(target_tree.branch)
31 source_tree.bzrdir.root_transport.put_bytes('foo', 'foo\nbar\n')
32 source_tree.commit('added bar')
33 # Add a fake revisions so the proposal is ready.
34 self.factory.makeRevisionsForBranch(source, count=1)
35 bmp = BranchMergeProposal(
36 source_branch=source, target_branch=target,
37 registrant=source.owner)
38 job = UpdatePreviewDiffJob.create(bmp)
39 self.assertIs(None, bmp.preview_diff)
40 transaction.commit()
41 return job, bmp, source_tree
42
43 def test_update_preview_diffs(self):
44 """Ensure update_preview_diffs runs and generates diffs."""
45 job, bmp, source_tree = self.create_preview_diff_job()
46 retcode, stdout, stderr = run_script(
47 'cronscripts/update_preview_diffs.py', [])
48 self.assertEqual(0, retcode)
49 self.assertEqual('', stdout)
50 self.assertEqual(
51 'INFO creating lockfile\n'
52 'INFO Running synchronously.\n'
53 'INFO Ran 1 IUpdatePreviewDiffJobSource jobs.\n'
54 'INFO 0 IUpdatePreviewDiffJobSource jobs did not complete.\n',
55 stderr)
56 self.assertIsNot(None, bmp.preview_diff)
57
58 def test_update_preview_diffs_twisted(self):
59 """Ensure update_preview_diffs runs and generates diffs."""
60 job, bmp, source_tree = self.create_preview_diff_job()
61 retcode, stdout, stderr = run_script(
62 'cronscripts/update_preview_diffs.py', ['--twisted'])
63 self.assertEqual(0, retcode)
64 self.assertEqual('', stdout)
65 self.assertEqual(
66 'INFO creating lockfile\n'
67 'INFO Running through Twisted.\n'
68 'INFO Ran 1 IUpdatePreviewDiffJobSource jobs.\n'
69 'INFO 0 IUpdatePreviewDiffJobSource jobs did not complete.\n',
70 stderr)
71 self.assertIsNot(None, bmp.preview_diff)
72
73 def test_update_preview_diffs_oops(self):
74 """Ensure update_preview_diffs runs and generates diffs."""
75 job, bmp, source_tree = self.create_preview_diff_job()
76 source_tree.bzrdir.root_transport.delete_tree('.bzr')
77 error_utility = errorlog.ErrorReportingUtility()
78 error_utility.configure('update_preview_diffs')
79 old_report = error_utility.getLastOopsReport()
80 if old_report is not None:
81 old_id = old_report.id
82 else:
83 old_id = None
84 retcode, stdout, stderr = run_script(
85 'cronscripts/update_preview_diffs.py', ['--twisted'])
86 self.assertEqual(0, retcode)
87 self.assertIn(
88 'INFO 1 IUpdatePreviewDiffJobSource jobs did not complete.\n',
89 stderr)
90 self.assertIn('INFO Job resulted in OOPS:', stderr)
91 new_id = error_utility.getLastOopsReport().id
92 self.assertNotEqual(old_id, new_id)
93
940
=== modified file 'lib/lp/code/scripts/tests/test_upgrade_branches.py'
--- lib/lp/code/scripts/tests/test_upgrade_branches.py 2010-01-22 06:03:19 +0000
+++ lib/lp/code/scripts/tests/test_upgrade_branches.py 2010-04-07 18:05:36 +0000
@@ -32,7 +32,7 @@
32 target_tree.branch.repository._format.get_format_string(),32 target_tree.branch.repository._format.get_format_string(),
33 'Bazaar-NG Knit Repository Format 1')33 'Bazaar-NG Knit Repository Format 1')
3434
35 job = BranchUpgradeJob.create(target)35 BranchUpgradeJob.create(target)
36 transaction.commit()36 transaction.commit()
3737
38 retcode, stdout, stderr = run_script(38 retcode, stdout, stderr = run_script(
@@ -40,7 +40,7 @@
40 expect_returncode=0)40 expect_returncode=0)
41 self.assertEqual('', stdout)41 self.assertEqual('', stdout)
42 self.assertIn(42 self.assertIn(
43 'INFO Ran 1 IBranchUpgradeJobSource jobs.\n', stderr)43 'INFO Ran 1 BranchUpgradeJob jobs.\n', stderr)
4444
45 target_branch = BzrBranch.open(target_tree.branch.base)45 target_branch = BzrBranch.open(target_tree.branch.base)
46 self.assertEqual(46 self.assertEqual(
@@ -60,7 +60,7 @@
60 target_tree.branch.repository._format.get_format_string(),60 target_tree.branch.repository._format.get_format_string(),
61 'Bazaar-NG Knit Repository Format 1')61 'Bazaar-NG Knit Repository Format 1')
6262
63 job = BranchUpgradeJob.create(target)63 BranchUpgradeJob.create(target)
64 transaction.commit()64 transaction.commit()
6565
66 retcode, stdout, stderr = run_script(66 retcode, stdout, stderr = run_script(
@@ -68,7 +68,7 @@
68 expect_returncode=0)68 expect_returncode=0)
69 self.assertEqual('', stdout)69 self.assertEqual('', stdout)
70 self.assertIn(70 self.assertIn(
71 'INFO Ran 1 IBranchUpgradeJobSource jobs.\n', stderr)71 'INFO Ran 1 BranchUpgradeJob jobs.\n', stderr)
7272
73 target_branch = BzrBranch.open(target_tree.branch.base)73 target_branch = BzrBranch.open(target_tree.branch.base)
74 self.assertEqual(74 self.assertEqual(
7575
=== modified file 'lib/lp/code/tests/helpers.py'
--- lib/lp/code/tests/helpers.py 2009-12-13 11:55:40 +0000
+++ lib/lp/code/tests/helpers.py 2010-04-07 18:05:36 +0000
@@ -19,6 +19,8 @@
19from zope.security.proxy import removeSecurityProxy19from zope.security.proxy import removeSecurityProxy
20from zope.security.proxy import isinstance as zisinstance20from zope.security.proxy import isinstance as zisinstance
2121
22from lp.code.interfaces.branchmergeproposal import (
23 IBranchMergeProposalJobSource)
22from lp.code.interfaces.seriessourcepackagebranch import (24from lp.code.interfaces.seriessourcepackagebranch import (
23 IMakeOfficialBranchLinks)25 IMakeOfficialBranchLinks)
24from lp.registry.interfaces.series import SeriesStatus26from lp.registry.interfaces.series import SeriesStatus
@@ -26,6 +28,20 @@
26from lp.testing import time_counter28from lp.testing import time_counter
2729
2830
31def mark_all_merge_proposal_jobs_done():
32 """Sometimes in tests we want to clear out all pending jobs.
33
34 This function iterates through all the pending jobs and marks the done.
35 """
36 while True:
37 jobs = list(getUtility(IBranchMergeProposalJobSource).iterReady())
38 if len(jobs) == 0:
39 break
40 for job in jobs:
41 job.start()
42 job.complete()
43
44
29def add_revision_to_branch(factory, branch, revision_date, date_created=None,45def add_revision_to_branch(factory, branch, revision_date, date_created=None,
30 mainline=True, commit_msg=None):46 mainline=True, commit_msg=None):
31 """Add a new revision to the branch with the specified revision date.47 """Add a new revision to the branch with the specified revision date.
3248
=== modified file 'lib/lp/codehosting/scanner/tests/test_bzrsync.py'
--- lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-03-09 19:52:02 +0000
+++ lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-04-07 18:05:36 +0000
@@ -655,17 +655,18 @@
655 @run_as_db_user(config.launchpad.dbuser)655 @run_as_db_user(config.launchpad.dbuser)
656 def test_create_on_new_revision(self):656 def test_create_on_new_revision(self):
657 """When branch tip changes, a job is created."""657 """When branch tip changes, a job is created."""
658 revision_id = self.commitRevision()
659 bmp = self.factory.makeBranchMergeProposal(658 bmp = self.factory.makeBranchMergeProposal(
660 source_branch=self.db_branch)659 source_branch=self.db_branch)
661 removeSecurityProxy(bmp).target_branch.last_scanned_id = 'rev'660 removeSecurityProxy(bmp).target_branch.last_scanned_id = 'rev'
661 # The creation of a merge proposal has created an update preview diff
662 # job, so we'll mark that one as done.
663 bmp.next_preview_diff_job.start()
664 bmp.next_preview_diff_job.complete()
665 self.assertIs(None, bmp.next_preview_diff_job)
662 transaction.commit()666 transaction.commit()
663 LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser)667 LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser)
664 self.makeBzrSync(self.db_branch).syncBranchAndClose()668 self.makeBzrSync(self.db_branch).syncBranchAndClose()
665 jobs = list(getUtility(IUpdatePreviewDiffJobSource).iterReady())669 self.assertIsNot(None, bmp.next_preview_diff_job)
666 self.assertEqual(1, len(jobs))
667 self.assertEqual(
668 bmp, removeSecurityProxy(jobs[0]).branch_merge_proposal)
669670
670671
671class TestRevisionProperty(BzrSyncTestCase):672class TestRevisionProperty(BzrSyncTestCase):
672673
=== modified file 'lib/lp/codehosting/scanner/tests/test_mergedetection.py'
--- lib/lp/codehosting/scanner/tests/test_mergedetection.py 2010-03-02 18:56:25 +0000
+++ lib/lp/codehosting/scanner/tests/test_mergedetection.py 2010-04-07 18:05:36 +0000
@@ -14,16 +14,21 @@
14from zope.component import getUtility14from zope.component import getUtility
15from zope.event import notify15from zope.event import notify
1616
17from canonical.config import config
18from canonical.launchpad.interfaces import IStore
19from canonical.testing import LaunchpadZopelessLayer
20
17from lp.codehosting.scanner import events21from lp.codehosting.scanner import events
18from lp.codehosting.scanner import mergedetection22from lp.codehosting.scanner import mergedetection
19from lp.codehosting.scanner.tests.test_bzrsync import (23from lp.codehosting.scanner.tests.test_bzrsync import (
20 BzrSyncTestCase, run_as_db_user)24 BzrSyncTestCase, run_as_db_user)
21from canonical.config import config
22from lp.code.enums import BranchLifecycleStatus, BranchMergeProposalStatus25from lp.code.enums import BranchLifecycleStatus, BranchMergeProposalStatus
26from lp.code.model.branchmergeproposaljob import (
27 BranchMergeProposalJob, BranchMergeProposalJobFactory,
28 BranchMergeProposalJobType)
23from lp.code.interfaces.branchlookup import IBranchLookup29from lp.code.interfaces.branchlookup import IBranchLookup
24from lp.testing import TestCaseWithFactory30from lp.testing import TestCaseWithFactory
25from lp.testing.mail_helpers import pop_notifications31from lp.testing.mail_helpers import pop_notifications
26from canonical.testing import LaunchpadZopelessLayer
2732
2833
29class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):34class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
@@ -35,7 +40,7 @@
35 @run_as_db_user(config.launchpad.dbuser)40 @run_as_db_user(config.launchpad.dbuser)
36 def createProposal(self, source, target):41 def createProposal(self, source, target):
37 # The scanner doesn't have insert rights, so do it here.42 # The scanner doesn't have insert rights, so do it here.
38 proposal = source.addLandingTarget(source.owner, target)43 source.addLandingTarget(source.owner, target)
39 transaction.commit()44 transaction.commit()
4045
41 def _createBranchesAndProposal(self):46 def _createBranchesAndProposal(self):
@@ -210,7 +215,7 @@
210 # Other branches for the product are checked, but if the tip revision215 # Other branches for the product are checked, but if the tip revision
211 # of the branch is not yet been set no merge event is emitted for that216 # of the branch is not yet been set no merge event is emitted for that
212 # branch.217 # branch.
213 source = self.factory.makeProductBranch(product=self.product)218 self.factory.makeProductBranch(product=self.product)
214 self.autoMergeBranches(self.db_branch, ['revid'])219 self.autoMergeBranches(self.db_branch, ['revid'])
215 self.assertEqual([], self.merges)220 self.assertEqual([], self.merges)
216221
@@ -257,6 +262,13 @@
257 self.assertEqual(262 self.assertEqual(
258 BranchLifecycleStatus.MERGED,263 BranchLifecycleStatus.MERGED,
259 proposal.source_branch.lifecycle_status)264 proposal.source_branch.lifecycle_status)
265 job = IStore(proposal).find(
266 BranchMergeProposalJob,
267 BranchMergeProposalJob.branch_merge_proposal == proposal,
268 BranchMergeProposalJob.job_type ==
269 BranchMergeProposalJobType.MERGE_PROPOSAL_UPDATED).one()
270 derived_job = BranchMergeProposalJobFactory.create(job)
271 derived_job.run()
260 notifications = pop_notifications()272 notifications = pop_notifications()
261 self.assertIn('Work in progress => Merged',273 self.assertIn('Work in progress => Merged',
262 notifications[0].get_payload(decode=True))274 notifications[0].get_payload(decode=True))
263275
=== modified file 'lib/lp/hardwaredb/doc/hwdb-submission.txt'
--- lib/lp/hardwaredb/doc/hwdb-submission.txt 2010-02-02 17:12:29 +0000
+++ lib/lp/hardwaredb/doc/hwdb-submission.txt 2010-04-07 18:05:36 +0000
@@ -270,7 +270,7 @@
270 >>> returnvalue270 >>> returnvalue
271 0271 0
272 >>> print err272 >>> print err
273 INFO creating lockfile273 INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock
274 ERROR Parsing submission test_submission_id_1: syntax error:274 ERROR Parsing submission test_submission_id_1: syntax error:
275 line 1, column 0275 line 1, column 0
276 INFO Processed 0 valid and 1 invalid HWDB submissions276 INFO Processed 0 valid and 1 invalid HWDB submissions
@@ -306,7 +306,7 @@
306 >>> returnvalue306 >>> returnvalue
307 0307 0
308 >>> print err308 >>> print err
309 INFO creating lockfile309 INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock
310 ERROR Parsing submission unique-id-1: syntax error: line 1, column 0310 ERROR Parsing submission unique-id-1: syntax error: line 1, column 0
311 INFO Processed 1 valid and 1 invalid HWDB submissions311 INFO Processed 1 valid and 1 invalid HWDB submissions
312 >>> print out312 >>> print out
@@ -366,7 +366,7 @@
366 >>> returnvalue366 >>> returnvalue
367 0367 0
368 >>> print err368 >>> print err
369 INFO creating lockfile369 INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock
370 INFO Processed 60 valid and 0 invalid HWDB submissions370 INFO Processed 60 valid and 0 invalid HWDB submissions
371 >>> print out371 >>> print out
372 <BLANKLINE>372 <BLANKLINE>
@@ -403,7 +403,7 @@
403 >>> returnvalue403 >>> returnvalue
404 0404 0
405 >>> print err405 >>> print err
406 INFO creating lockfile406 INFO Creating lockfile: /var/lock/launchpad-hwdbsubmissions.lock
407 INFO Processed 100 valid and 0 invalid HWDB submissions407 INFO Processed 100 valid and 0 invalid HWDB submissions
408 >>> print out408 >>> print out
409 <BLANKLINE>409 <BLANKLINE>
410410
=== modified file 'lib/lp/registry/doc/distribution-mirror.txt'
--- lib/lp/registry/doc/distribution-mirror.txt 2010-03-31 11:57:54 +0000
+++ lib/lp/registry/doc/distribution-mirror.txt 2010-04-07 18:05:36 +0000
@@ -585,7 +585,7 @@
585 >>> print stdout585 >>> print stdout
586 <BLANKLINE>586 <BLANKLINE>
587 >>> print stderr587 >>> print stderr
588 INFO creating lockfile588 INFO Creating lockfile: /var/lock/launchpad-distributionmirror-prober.lock
589 INFO Probing Archive Mirrors589 INFO Probing Archive Mirrors
590 INFO Probed 4 mirrors.590 INFO Probed 4 mirrors.
591 INFO Disabling 1 mirror(s):591 INFO Disabling 1 mirror(s):
@@ -599,7 +599,7 @@
599 >>> print stdout599 >>> print stdout
600 <BLANKLINE>600 <BLANKLINE>
601 >>> print stderr601 >>> print stderr
602 INFO creating lockfile602 INFO Creating lockfile: /var/lock/launchpad-distributionmirror-prober.lock
603 INFO Probing CD Image Mirrors603 INFO Probing CD Image Mirrors
604 INFO Probed 4 mirrors.604 INFO Probed 4 mirrors.
605 INFO Disabling 1 mirror(s):605 INFO Disabling 1 mirror(s):
@@ -615,7 +615,7 @@
615 >>> print stdout615 >>> print stdout
616 <BLANKLINE>616 <BLANKLINE>
617 >>> print stderr617 >>> print stderr
618 INFO creating lockfile618 INFO Creating lockfile: /var/lock/launchpad-distributionmirror-prober.lock
619 INFO Probing CD Image Mirrors619 INFO Probing CD Image Mirrors
620 INFO No mirrors to probe.620 INFO No mirrors to probe.
621 INFO Done.621 INFO Done.
@@ -628,7 +628,7 @@
628 >>> print stdout628 >>> print stdout
629 <BLANKLINE>629 <BLANKLINE>
630 >>> print stderr630 >>> print stderr
631 INFO creating lockfile631 INFO Creating lockfile: /var/lock/launchpad-distributionmirror-prober.lock
632 INFO Probing CD Image Mirrors632 INFO Probing CD Image Mirrors
633 INFO Probed 4 mirrors.633 INFO Probed 4 mirrors.
634 INFO Done.634 INFO Done.
@@ -647,7 +647,7 @@
647 >>> transaction.commit()647 >>> transaction.commit()
648 >>> prober, stdout, stderr = run_prober('--content-type=cdimage --force')648 >>> prober, stdout, stderr = run_prober('--content-type=cdimage --force')
649 >>> print stderr649 >>> print stderr
650 INFO creating lockfile650 INFO Creating lockfile: /var/lock/launchpad-distributionmirror-prober.lock
651 INFO Probing CD Image Mirrors651 INFO Probing CD Image Mirrors
652 INFO Probed 4 mirrors.652 INFO Probed 4 mirrors.
653 INFO Re-enabling 1 mirror(s):653 INFO Re-enabling 1 mirror(s):
654654
=== modified file 'lib/lp/registry/doc/person-karma.txt'
--- lib/lp/registry/doc/person-karma.txt 2010-03-15 12:32:37 +0000
+++ lib/lp/registry/doc/person-karma.txt 2010-04-07 18:05:36 +0000
@@ -131,7 +131,7 @@
131 ... stderr=subprocess.PIPE)131 ... stderr=subprocess.PIPE)
132 >>> (out, err) = process.communicate()132 >>> (out, err) = process.communicate()
133 >>> print err133 >>> print err
134 INFO creating lockfile134 INFO Creating lockfile: /var/lock/launchpad-karma-update.lock
135 INFO Updating Launchpad karma caches135 INFO Updating Launchpad karma caches
136 INFO Step A: Calculating individual KarmaCache entries136 INFO Step A: Calculating individual KarmaCache entries
137 INFO Scaling bugs by a factor of 2.6667 (capped to 2.0000)137 INFO Scaling bugs by a factor of 2.6667 (capped to 2.0000)
138138
=== modified file 'lib/lp/registry/doc/sourceforge-remote-products.txt'
--- lib/lp/registry/doc/sourceforge-remote-products.txt 2009-06-02 08:20:49 +0000
+++ lib/lp/registry/doc/sourceforge-remote-products.txt 2010-04-07 18:05:36 +0000
@@ -117,7 +117,7 @@
117 0117 0
118118
119 >>> print err119 >>> print err
120 INFO creating lockfile120 INFO Creating lockfile: /var/lock/launchpad-updateremoteproduct.lock
121 INFO No Products to update.121 INFO No Products to update.
122 INFO Time for this run: ... seconds.122 INFO Time for this run: ... seconds.
123 DEBUG Removing lock file:...123 DEBUG Removing lock file:...
124124
=== modified file 'lib/lp/registry/doc/standing.txt'
--- lib/lp/registry/doc/standing.txt 2009-08-13 19:03:36 +0000
+++ lib/lp/registry/doc/standing.txt 2010-04-07 18:05:36 +0000
@@ -260,7 +260,7 @@
260 >>> print stdout260 >>> print stdout
261 <BLANKLINE>261 <BLANKLINE>
262 >>> print stderr262 >>> print stderr
263 INFO creating lockfile263 INFO Creating lockfile: /var/lock/launchpad-update-personal-standing.lock
264 INFO Updating personal standings264 INFO Updating personal standings
265 INFO Done.265 INFO Done.
266 <BLANKLINE>266 <BLANKLINE>
@@ -294,7 +294,7 @@
294 >>> print stdout294 >>> print stdout
295 <BLANKLINE>295 <BLANKLINE>
296 >>> print stderr296 >>> print stderr
297 INFO creating lockfile297 INFO Creating lockfile: /var/lock/launchpad-update-personal-standing.lock
298 INFO Updating personal standings298 INFO Updating personal standings
299 INFO Done.299 INFO Done.
300 <BLANKLINE>300 <BLANKLINE>
301301
=== modified file 'lib/lp/services/job/tests/test_runner.py'
--- lib/lp/services/job/tests/test_runner.py 2010-03-11 16:37:22 +0000
+++ lib/lp/services/job/tests/test_runner.py 2010-04-07 18:05:36 +0000
@@ -297,6 +297,10 @@
297 def __init__(self):297 def __init__(self):
298 self.entries = []298 self.entries = []
299299
300 def debug(self, input, *args):
301 # We don't care about debug messages.
302 pass
303
300 def info(self, input, *args):304 def info(self, input, *args):
301 self.entries.append(input)305 self.entries.append(input)
302306
@@ -338,7 +342,7 @@
338 @classmethod342 @classmethod
339 def runFromSource(cls, source, dbuser, logger):343 def runFromSource(cls, source, dbuser, logger):
340 expected_config = errorlog.ErrorReportingUtility()344 expected_config = errorlog.ErrorReportingUtility()
341 expected_config.configure('update_preview_diffs')345 expected_config.configure('merge_proposal_jobs')
342 self.assertEqual(346 self.assertEqual(
343 errorlog.globalErrorUtility.oops_prefix,347 errorlog.globalErrorUtility.oops_prefix,
344 expected_config.oops_prefix)348 expected_config.oops_prefix)
@@ -348,7 +352,7 @@
348 incomplete_jobs = []352 incomplete_jobs = []
349353
350 class JobCronScriptSubclass(JobCronScript):354 class JobCronScriptSubclass(JobCronScript):
351 config_name = 'update_preview_diffs'355 config_name = 'merge_proposal_jobs'
352 source_interface = IUpdatePreviewDiffJobSource356 source_interface = IUpdatePreviewDiffJobSource
353357
354 def __init__(self):358 def __init__(self):
355359
=== modified file 'lib/lp/services/mail/sendmail.py'
--- lib/lp/services/mail/sendmail.py 2010-04-07 18:05:11 +0000
+++ lib/lp/services/mail/sendmail.py 2010-04-07 18:05:36 +0000
@@ -45,10 +45,10 @@
45from zope.security.proxy import isinstance as zisinstance45from zope.security.proxy import isinstance as zisinstance
4646
47from canonical.config import config47from canonical.config import config
48from canonical.launchpad import versioninfo
49from canonical.launchpad.helpers import is_ascii_only
48from canonical.lp import isZopeless50from canonical.lp import isZopeless
49from canonical.launchpad.helpers import is_ascii_only
50from lp.services.mail.stub import TestMailer51from lp.services.mail.stub import TestMailer
51from canonical.launchpad import versioninfo
5252
53# email package by default ends up encoding UTF-8 messages using base64,53# email package by default ends up encoding UTF-8 messages using base64,
54# which sucks as they look like spam to stupid spam filters. We define54# which sucks as they look like spam to stupid spam filters. We define
@@ -409,21 +409,28 @@
409 message['X-Launchpad-Hash'] = hash.hexdigest()409 message['X-Launchpad-Hash'] = hash.hexdigest()
410410
411 raw_message = message.as_string()411 raw_message = message.as_string()
412 if isZopeless():
413 # Zopeless email sending is not unit tested, and won't be.
414 # The zopeless specific stuff is pretty simple though so this
415 # should be fine.
416412
417 if config.instance_name == 'testrunner':413 if isZopeless() and config.instance_name == 'testrunner':
418 # when running in the testing environment, store emails414 # when running in the testing environment, store emails
419 TestMailer().send(415 TestMailer().send(
420 config.canonical.bounce_address, to_addrs, raw_message)416 config.canonical.bounce_address, to_addrs, raw_message)
421 else:
422 return raw_sendmail(
423 config.canonical.bounce_address, to_addrs, raw_message)
424 # Strip the angle brackets to the return a Message-Id consistent with417 # Strip the angle brackets to the return a Message-Id consistent with
425 # raw_sendmail (which doesn't include them).418 # raw_sendmail (which doesn't include them).
426 return message['message-id'][1:-1]419 return message['message-id'][1:-1]
420 elif isZopeless() and config.instance_name == 'testrunner-appserver':
421 if config.zopeless.send_email:
422 # Note that we simply throw away dud recipients. This is fine,
423 # as it emulates the Z3 API which doesn't report this either
424 # (because actual delivery is done later).
425 smtp = SMTP(
426 config.zopeless.smtp_host, config.zopeless.smtp_port)
427
428 # The "MAIL FROM" is set to the bounce address, to behave in a
429 # way similar to mailing list software.
430 smtp.sendmail(
431 config.canonical.bounce_address, to_addrs, raw_message)
432 smtp.quit()
433 return message['message-id'][1:-1]
427 else:434 else:
428 # The "MAIL FROM" is set to the bounce address, to behave in a way435 # The "MAIL FROM" is set to the bounce address, to behave in a way
429 # similar to mailing list software.436 # similar to mailing list software.
430437
=== modified file 'lib/lp/soyuz/doc/buildd-slavescanner.txt'
--- lib/lp/soyuz/doc/buildd-slavescanner.txt 2010-03-24 04:51:25 +0000
+++ lib/lp/soyuz/doc/buildd-slavescanner.txt 2010-04-07 18:05:36 +0000
@@ -500,7 +500,7 @@
500 * Build Log: http://.../...i386.mozilla-firefox_0.9_NEEDSBUILD.txt.gz500 * Build Log: http://.../...i386.mozilla-firefox_0.9_NEEDSBUILD.txt.gz
501 ...501 ...
502 Upload log:502 Upload log:
503 INFO creating lockfile503 INFO Creating lockfile: /var/lock/process-upload-buildd.lock
504 DEBUG Initialising connection.504 DEBUG Initialising connection.
505 ...505 ...
506 DEBUG Removing lock file: /var/lock/process-upload-buildd.lock506 DEBUG Removing lock file: /var/lock/process-upload-buildd.lock
@@ -737,7 +737,7 @@
737 ... 'uploader.log'))737 ... 'uploader.log'))
738738
739 >>> print uploader_log.read()739 >>> print uploader_log.read()
740 INFO creating lockfile740 INFO Creating lockfile: /var/lock/process-upload-buildd.lock
741 DEBUG Initialising connection.741 DEBUG Initialising connection.
742 DEBUG Beginning processing742 DEBUG Beginning processing
743 DEBUG Creating directory /var/tmp/builddmaster/accepted743 DEBUG Creating directory /var/tmp/builddmaster/accepted
744744
=== modified file 'lib/lp/soyuz/doc/gina.txt'
--- lib/lp/soyuz/doc/gina.txt 2010-03-17 05:48:45 +0000
+++ lib/lp/soyuz/doc/gina.txt 2010-04-07 18:05:36 +0000
@@ -730,7 +730,7 @@
730 >>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE)730 >>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE)
731731
732 >>> print proc.stderr.read()732 >>> print proc.stderr.read()
733 INFO creating lockfile733 INFO Creating lockfile: /var/lock/launchpad-gina.lock
734 ...734 ...
735 INFO === Processing debian/lenny/release ===735 INFO === Processing debian/lenny/release ===
736 ...736 ...
737737
=== modified file 'lib/lp/soyuz/doc/manage-chroot.txt'
--- lib/lp/soyuz/doc/manage-chroot.txt 2009-04-28 12:59:43 +0000
+++ lib/lp/soyuz/doc/manage-chroot.txt 2010-04-07 18:05:36 +0000
@@ -68,7 +68,7 @@
68 >>> process.returncode68 >>> process.returncode
69 069 0
70 >>> print stderr70 >>> print stderr
71 INFO creating lockfile71 INFO Creating lockfile: /var/lock/launchpad-mangage-chroot.lock
72 DEBUG Initialising ChrootManager for 'The Hoary Hedgehog Release for i386 (x86)'72 DEBUG Initialising ChrootManager for 'The Hoary Hedgehog Release for i386 (x86)'
73 DEBUG LibraryFileAlias: ..., 25 bytes, 04a60337a417012f7c51fb56d59d2d0d73 DEBUG LibraryFileAlias: ..., 25 bytes, 04a60337a417012f7c51fb56d59d2d0d
74 DEBUG PocketChroot for 'The Hoary Hedgehog Release for i386 (x86)' (1) added.74 DEBUG PocketChroot for 'The Hoary Hedgehog Release for i386 (x86)' (1) added.
7575
=== modified file 'lib/lp/soyuz/doc/package-cache-script.txt'
--- lib/lp/soyuz/doc/package-cache-script.txt 2009-04-28 12:59:43 +0000
+++ lib/lp/soyuz/doc/package-cache-script.txt 2010-04-07 18:05:36 +0000
@@ -46,7 +46,7 @@
46 >>> print stdout46 >>> print stdout
4747
48 >>> print stderr48 >>> print stderr
49 INFO creating lockfile49 INFO Creating lockfile: /var/lock/launchpad-update-cache.lock
50 INFO Updating ubuntu package counters50 INFO Updating ubuntu package counters
51 INFO Updating ubuntu main archives51 INFO Updating ubuntu main archives
52 ...52 ...
5353
=== modified file 'lib/lp/soyuz/scripts/tests/test_processupload.py'
--- lib/lp/soyuz/scripts/tests/test_processupload.py 2009-06-25 04:06:00 +0000
+++ lib/lp/soyuz/scripts/tests/test_processupload.py 2010-04-07 18:05:36 +0000
@@ -76,7 +76,7 @@
76 # proper log message76 # proper log message
77 self.assertEqual(1, returncode)77 self.assertEqual(1, returncode)
78 self.assertEqual(78 self.assertEqual(
79 ['INFO creating lockfile',79 ['INFO Creating lockfile: /var/lock/process-upload-insecure.lock',
80 'DEBUG Lockfile /var/lock/process-upload-insecure.lock in use'80 'DEBUG Lockfile /var/lock/process-upload-insecure.lock in use'
81 ], err.splitlines())81 ], err.splitlines())
8282
8383
=== modified file 'lib/lp/translations/doc/distroseries-translations-copy.txt'
--- lib/lp/translations/doc/distroseries-translations-copy.txt 2010-02-19 16:54:42 +0000
+++ lib/lp/translations/doc/distroseries-translations-copy.txt 2010-04-07 18:05:36 +0000
@@ -193,7 +193,8 @@
193 >>> returnvalue193 >>> returnvalue
194 1194 1
195 >>> print error_output195 >>> print error_output
196 INFO creating lockfile196 INFO Creating lockfile:
197 /var/lock/launchpad-copy-missing-translations-foobuntu-darty.lock
197 ERROR Before this process starts, set the hide_all_translations and198 ERROR Before this process starts, set the hide_all_translations and
198 defer_translation_imports flags for distribution foobuntu, series199 defer_translation_imports flags for distribution foobuntu, series
199 darty; or use the --force option to make it happen200 darty; or use the --force option to make it happen
@@ -219,7 +220,8 @@
219 >>> returnvalue220 >>> returnvalue
220 0221 0
221 >>> print error_output222 >>> print error_output
222 INFO creating lockfile223 INFO Creating lockfile:
224 /var/lock/launchpad-copy-missing-translations-foobuntu-darty.lock
223 INFO Starting...225 INFO Starting...
224 INFO Populating blank distroseries darty with translations from barty.226 INFO Populating blank distroseries darty with translations from barty.
225 INFO Extracting from POTemplate into227 INFO Extracting from POTemplate into
226228
=== modified file 'lib/lp/translations/doc/fix_translation_credits.txt'
--- lib/lp/translations/doc/fix_translation_credits.txt 2009-11-06 09:41:12 +0000
+++ lib/lp/translations/doc/fix_translation_credits.txt 2010-04-07 18:05:36 +0000
@@ -9,7 +9,8 @@
9 >>> print returncode9 >>> print returncode
10 010 0
11 >>> print err11 >>> print err
12 INFO creating lockfile12 INFO Creating lockfile:
13 /var/lock/launchpad-fix-translation-credits.lock
13 INFO Figuring out POFiles that need fixing: this may take a while...14 INFO Figuring out POFiles that need fixing: this may take a while...
14 INFO Marking up a total of 3 credits as translated.15 INFO Marking up a total of 3 credits as translated.
15 INFO Processed ...16 INFO Processed ...
1617
=== modified file 'lib/lp/translations/doc/poexport-language-pack.txt'
--- lib/lp/translations/doc/poexport-language-pack.txt 2009-11-17 09:50:33 +0000
+++ lib/lp/translations/doc/poexport-language-pack.txt 2010-04-07 18:05:36 +0000
@@ -546,7 +546,8 @@
546 >>> print err546 >>> print err
547 INFO Setting lockfile name to547 INFO Setting lockfile name to
548 launchpad-language-pack-exporter__ubuntu__hoary.lock.548 launchpad-language-pack-exporter__ubuntu__hoary.lock.
549 INFO creating lockfile549 INFO Creating lockfile:
550 /var/lock/launchpad-language-pack-exporter__ubuntu__hoary.lock
550 INFO Exporting translations for series hoary of distribution ubuntu.551 INFO Exporting translations for series hoary of distribution ubuntu.
551 INFO Number of PO files to export: 12552 INFO Number of PO files to export: 12
552 INFO Exporting XPI template files.553 INFO Exporting XPI template files.
553554
=== modified file 'lib/lp/translations/doc/poexport-request.txt'
--- lib/lp/translations/doc/poexport-request.txt 2010-03-05 20:40:40 +0000
+++ lib/lp/translations/doc/poexport-request.txt 2010-04-07 18:05:36 +0000
@@ -266,7 +266,7 @@
266 ... )266 ... )
267 >>> (output, empty) = process.communicate()267 >>> (output, empty) = process.communicate()
268 >>> print output268 >>> print output
269 INFO creating lockfile269 INFO Creating lockfile: /var/lock/launchpad-rosetta-export-queue.lock
270 DEBUG Exporting objects for Happy Downloader, related to template270 DEBUG Exporting objects for Happy Downloader, related to template
271 evolution-2.2 in Evolution trunk271 evolution-2.2 in Evolution trunk
272 DEBUG Exporting objects for Happy Downloader, related to template272 DEBUG Exporting objects for Happy Downloader, related to template
273273
=== modified file 'lib/lp/translations/doc/pofile-verify-stats.txt'
--- lib/lp/translations/doc/pofile-verify-stats.txt 2009-08-10 16:52:41 +0000
+++ lib/lp/translations/doc/pofile-verify-stats.txt 2010-04-07 18:05:36 +0000
@@ -176,7 +176,7 @@
176 >>> print returncode176 >>> print returncode
177 0177 0
178 >>> print err178 >>> print err
179 INFO creating lockfile179 INFO Creating lockfile: /var/lock/launchpad-pofile-stats-daily.lock
180 INFO Verifying stats of POFiles updated in the last ... days.180 INFO Verifying stats of POFiles updated in the last ... days.
181 INFO Verifying a total of 1 POFiles.181 INFO Verifying a total of 1 POFiles.
182 INFO Done.182 INFO Done.
@@ -192,7 +192,7 @@
192 >>> print returncode192 >>> print returncode
193 0193 0
194 >>> print err194 >>> print err
195 INFO creating lockfile195 INFO Creating lockfile: /var/lock/launchpad-pofile-stats.lock
196 INFO Starting verification of POFile stats at id 99196 INFO Starting verification of POFile stats at id 99
197 INFO Done.197 INFO Done.
198198
199199
=== modified file 'lib/lp/translations/doc/rosetta-poimport-script.txt'
--- lib/lp/translations/doc/rosetta-poimport-script.txt 2009-11-17 09:50:33 +0000
+++ lib/lp/translations/doc/rosetta-poimport-script.txt 2010-04-07 18:05:36 +0000
@@ -88,7 +88,7 @@
88 >>> process.returncode88 >>> process.returncode
89 089 0
90 >>> print stderr90 >>> print stderr
91 INFO creating lockfile91 INFO Creating lockfile: /var/lock/launchpad-rosetta-poimport.lock
92 INFO Importing: Serbian (sr) translation of evolution-2.2 in Evolution trunk92 INFO Importing: Serbian (sr) translation of evolution-2.2 in Evolution trunk
93 INFO Import requests completed.93 INFO Import requests completed.
94 <BLANKLINE>94 <BLANKLINE>
9595
=== modified file 'lib/lp/translations/doc/sourcepackagerelease-translations.txt'
--- lib/lp/translations/doc/sourcepackagerelease-translations.txt 2009-07-20 15:05:42 +0000
+++ lib/lp/translations/doc/sourcepackagerelease-translations.txt 2010-04-07 18:05:36 +0000
@@ -93,7 +93,8 @@
93 ... )93 ... )
94 >>> (output, empty) = process.communicate()94 >>> (output, empty) = process.communicate()
95 >>> print output95 >>> print output
96 INFO creating lockfile96 INFO Creating lockfile:
97 /var/lock/launchpad-translations-import-queue-gardener.lock
97 INFO The automatic approval system approved some entries.98 INFO The automatic approval system approved some entries.
98 INFO Removed 2 entries from the queue.99 INFO Removed 2 entries from the queue.
99 <BLANKLINE>100 <BLANKLINE>
@@ -108,7 +109,7 @@
108 ... )109 ... )
109 >>> (output, empty) = process.communicate()110 >>> (output, empty) = process.communicate()
110 >>> print output111 >>> print output
111 INFO creating lockfile112 INFO Creating lockfile: /var/lock/launchpad-rosetta-poimport.lock
112 INFO Importing: Spanish (es) translation of pmount in Ubuntu Hoary package "pmount"113 INFO Importing: Spanish (es) translation of pmount in Ubuntu Hoary package "pmount"
113 ...114 ...
114115
115116
=== modified file 'lib/lp/translations/doc/translations-export-to-branch.txt'
--- lib/lp/translations/doc/translations-export-to-branch.txt 2010-03-09 04:35:26 +0000
+++ lib/lp/translations/doc/translations-export-to-branch.txt 2010-04-07 18:05:36 +0000
@@ -12,7 +12,7 @@
12 >>> stdout12 >>> stdout
13 ''13 ''
14 >>> print stderr14 >>> print stderr
15 INFO creating lockfile15 INFO Creating lockfile: /var/lock/launchpad-translations-export-to-branch.lock
16 INFO Exporting to translations branches.16 INFO Exporting to translations branches.
17 INFO Processed 0 item(s); 0 failure(s).17 INFO Processed 0 item(s); 0 failure(s).
1818
1919
=== modified file 'lib/lp/translations/scripts/tests/test_translations_to_branch.py'
--- lib/lp/translations/scripts/tests/test_translations_to_branch.py 2010-03-08 16:18:45 +0000
+++ lib/lp/translations/scripts/tests/test_translations_to_branch.py 2010-04-07 18:05:36 +0000
@@ -77,7 +77,7 @@
7777
78 self.assertEqual('', stdout)78 self.assertEqual('', stdout)
79 self.assertEqual(79 self.assertEqual(
80 'INFO creating lockfile\n'80 'INFO Creating lockfile: /var/lock/launchpad-translations-export-to-branch.lock\n'
81 'INFO Exporting to translations branches.\n'81 'INFO Exporting to translations branches.\n'
82 'INFO Exporting Committobranch trunk series.\n'82 'INFO Exporting Committobranch trunk series.\n'
83 'INFO Processed 1 item(s); 0 failure(s).',83 'INFO Processed 1 item(s); 0 failure(s).',

Subscribers

People subscribed via source and target branches

to status/vote changes: