~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/scripts/tests/test_sendbranchmail.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-12 14:04:40 UTC
  • mfrom: (13626.4.5 bug-820511)
  • Revision ID: launchpad@pqm.canonical.com-20110812140440-77ku5ve8yqeo4a9s
[r=jcsackett][bug=820511] Log Job IDs on INFO level when running jobs
 to ease debugging efforts when things go wrong.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        """Ensure sendbranchmail runs and sends email."""
50
50
        self.useBzrBranches()
51
51
        branch, tree = self.createBranch()
52
 
        RevisionMailJob.create(
 
52
        mail_job = RevisionMailJob.create(
53
53
            branch, 1, 'from@example.org', 'body', True, 'foo')
54
54
        transaction.commit()
55
55
        retcode, stdout, stderr = run_script(
56
56
            'cronscripts/sendbranchmail.py', [])
57
57
        self.assertEqual(
58
58
            'INFO    Creating lockfile: /var/lock/launchpad-sendbranchmail.lock\n'
59
 
            'INFO    Ran 1 RevisionMailJobs.\n', stderr)
 
59
            'INFO    Running RevisionMailJob (ID %d) in status Waiting\n'
 
60
            'INFO    Ran 1 RevisionMailJobs.\n' % mail_job.job.id, stderr)
60
61
        self.assertEqual('', stdout)
61
62
        self.assertEqual(0, retcode)
62
63
 
86
87
        # required to generate the revision-id.
87
88
        with override_environ(BZR_EMAIL='me@example.com'):
88
89
            tree.commit('Added foo.', rev_id='rev2')
89
 
        RevisionsAddedJob.create(
 
90
        job = RevisionsAddedJob.create(
90
91
            branch, 'rev1', 'rev2', 'from@example.org')
91
92
        transaction.commit()
92
93
        retcode, stdout, stderr = run_script(
93
94
            'cronscripts/sendbranchmail.py', [])
94
95
        self.assertEqual(
95
96
            'INFO    Creating lockfile: /var/lock/launchpad-sendbranchmail.lock\n'
96
 
            'INFO    Ran 1 RevisionMailJobs.\n',
 
97
            'INFO    Running RevisionsAddedJob (ID %d) in status Waiting\n'
 
98
            'INFO    Ran 1 RevisionMailJobs.\n' % job.job.id,
97
99
            stderr)
98
100
        self.assertEqual('', stdout)
99
101
        self.assertEqual(0, retcode)