Merge ~cjwatson/launchpad:testfix-ampoule-19.12.0 into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: dac6bd0cce03389e3f9df485b33031e373ed5df5
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:testfix-ampoule-19.12.0
Merge into: launchpad:master
Diff against target: 54 lines (+17/-3)
2 files modified
lib/lp/code/scripts/tests/test_merge_proposal_jobs.py (+4/-3)
lib/lp/services/job/runner.py (+13/-0)
Reviewer Review Type Date Requested Status
Kristian Glass (community) Approve
Review via email: mp+378007@code.launchpad.net

Commit message

Fix test failures from upgrading to ampoule 19.12.0

To post a comment you must log in.
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py b/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py
2index fdad59d..5a518ba 100644
3--- a/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py
4+++ b/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py
5@@ -37,14 +37,15 @@ class TestMergeProposalJobScript(DiffTestCase):
6 'Log opened.\n'
7 'INFO Log opened.\n'
8 'ProcessPool stats:\n'
9+ ' workers: 0\n'
10+ '(.|\n)*'
11 'INFO ProcessPool stats:\n'
12- '\tworkers: 0\n'
13- 'INFO \tworkers: 0\n'
14+ ' workers: 0\n'
15 '(.|\n)*'
16 'INFO Running '
17 '<GENERATE_INCREMENTAL_DIFF job for merge .*?> \(ID %d\).\n'
18 '(.|\n)*'
19- 'INFO STOPPING: \'\'\n'
20+ 'INFO STOPPING: \n'
21 'Main loop terminated.\n'
22 'INFO Main loop terminated.\n'
23 'INFO Ran 1 GenerateIncrementalDiffJob jobs.\n' % job.job.id)
24diff --git a/lib/lp/services/job/runner.py b/lib/lp/services/job/runner.py
25index 800d303..cdcf604 100644
26--- a/lib/lp/services/job/runner.py
27+++ b/lib/lp/services/job/runner.py
28@@ -481,6 +481,18 @@ class JobRunnerProcess(child.AMPChild):
29 return {'success': len(runner.completed_jobs), 'oops_id': oops_id}
30
31
32+class QuietAMPConnector(main.AMPConnector):
33+ """An `AMPConnector` that logs stderr output more quietly."""
34+
35+ def errReceived(self, data):
36+ for line in data.strip().splitlines():
37+ # Unlike the default implementation, we log this at INFO rather
38+ # than ERROR. Launchpad generates OOPSes for anything at
39+ # WARNING or above; we still want to do that if a child process
40+ # exits fatally, but not if it just writes something to stderr.
41+ main.log.info(u'FROM {n}: {l}', n=self.name, l=line)
42+
43+
44 class TwistedJobRunner(BaseJobRunner):
45 """Run Jobs via twisted."""
46
47@@ -493,6 +505,7 @@ class TwistedJobRunner(BaseJobRunner):
48 env['PYTHONPATH'] = os.pathsep.join(sys.path)
49 starter = main.ProcessStarter(
50 bootstrap="import _pythonpath\n" + main.BOOTSTRAP, env=env)
51+ starter.connectorFactory = QuietAMPConnector
52 super(TwistedJobRunner, self).__init__(logger, error_utility)
53 self.job_source = job_source
54 self.import_name = '%s.%s' % (

Subscribers

People subscribed via source and target branches

to status/vote changes: