← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad:testfix-ampoule-19.12.0 into launchpad:master.

Commit message:
Fix test failures from upgrading to ampoule 19.12.0

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/378007
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:testfix-ampoule-19.12.0 into launchpad:master.
diff --git a/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py b/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py
index fdad59d..5a518ba 100644
--- a/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py
+++ b/lib/lp/code/scripts/tests/test_merge_proposal_jobs.py
@@ -37,14 +37,15 @@ class TestMergeProposalJobScript(DiffTestCase):
             'Log opened.\n'
             'INFO    Log opened.\n'
             'ProcessPool stats:\n'
+            '    workers:       0\n'
+            '(.|\n)*'
             'INFO    ProcessPool stats:\n'
-            '\tworkers: 0\n'
-            'INFO    \tworkers: 0\n'
+            '    workers:       0\n'
             '(.|\n)*'
             'INFO    Running '
             '<GENERATE_INCREMENTAL_DIFF job for merge .*?> \(ID %d\).\n'
             '(.|\n)*'
-            'INFO    STOPPING: \'\'\n'
+            'INFO    STOPPING: \n'
             'Main loop terminated.\n'
             'INFO    Main loop terminated.\n'
             'INFO    Ran 1 GenerateIncrementalDiffJob jobs.\n' % job.job.id)
diff --git a/lib/lp/services/job/runner.py b/lib/lp/services/job/runner.py
index 800d303..cdcf604 100644
--- a/lib/lp/services/job/runner.py
+++ b/lib/lp/services/job/runner.py
@@ -481,6 +481,18 @@ class JobRunnerProcess(child.AMPChild):
         return {'success': len(runner.completed_jobs), 'oops_id': oops_id}
 
 
+class QuietAMPConnector(main.AMPConnector):
+    """An `AMPConnector` that logs stderr output more quietly."""
+
+    def errReceived(self, data):
+        for line in data.strip().splitlines():
+            # Unlike the default implementation, we log this at INFO rather
+            # than ERROR.  Launchpad generates OOPSes for anything at
+            # WARNING or above; we still want to do that if a child process
+            # exits fatally, but not if it just writes something to stderr.
+            main.log.info(u'FROM {n}: {l}', n=self.name, l=line)
+
+
 class TwistedJobRunner(BaseJobRunner):
     """Run Jobs via twisted."""
 
@@ -493,6 +505,7 @@ class TwistedJobRunner(BaseJobRunner):
         env['PYTHONPATH'] = os.pathsep.join(sys.path)
         starter = main.ProcessStarter(
             bootstrap="import _pythonpath\n" + main.BOOTSTRAP, env=env)
+        starter.connectorFactory = QuietAMPConnector
         super(TwistedJobRunner, self).__init__(logger, error_utility)
         self.job_source = job_source
         self.import_name = '%s.%s' % (