← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/unbreak-ec2test-results into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/unbreak-ec2test-results into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #726243 ec2 no longer keeps track of failed tests
  https://bugs.launchpad.net/bugs/726243

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/unbreak-ec2test-results/+merge/51483

r12453 broke ec2's summary emails. It now tries to get numbers and failed tests out of a MultiTestResult, which just delegates events to its children, storing no data of its own.

This branch fixes LaunchpadTester._gather_test_output to return a SummaryResult as before, and adds a test the ensure that its result keeps track of things properly. A MultiTestResult is still used internally, since we need to also notify the FailureUpdateResult.
-- 
https://code.launchpad.net/~wgrant/launchpad/unbreak-ec2test-results/+merge/51483
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/unbreak-ec2test-results into lp:launchpad.
=== modified file 'lib/devscripts/ec2test/remote.py'
--- lib/devscripts/ec2test/remote.py	2011-02-24 13:57:10 +0000
+++ lib/devscripts/ec2test/remote.py	2011-02-28 01:02:59 +0000
@@ -281,15 +281,16 @@
     def _gather_test_output(self, input_stream, logger):
         """Write the testrunner output to the logs."""
         summary_stream = logger.get_summary_stream()
+        summary_result = SummaryResult(summary_stream)
         result = MultiTestResult(
-            SummaryResult(summary_stream),
+            summary_result,
             FailureUpdateResult(logger))
         subunit_server = subunit.TestProtocolServer(result, summary_stream)
         for line in input_stream:
             subunit_server.lineReceived(line)
             logger.got_line(line)
             summary_stream.flush()
-        return result
+        return summary_result
 
 
 # XXX: Publish a JSON file that includes the relevant details from this

=== modified file 'lib/devscripts/ec2test/tests/test_remote.py'
--- lib/devscripts/ec2test/tests/test_remote.py	2011-02-24 22:31:25 +0000
+++ lib/devscripts/ec2test/tests/test_remote.py	2011-02-28 01:02:59 +0000
@@ -302,6 +302,18 @@
         # Message not being sent implies got_result thought it got a failure.
         self.assertEqual([], log)
 
+    def test_gather_test_output(self):
+        # LaunchpadTester._gather_test_output() summarises the output
+        # stream as a TestResult.
+        logger = self.make_logger()
+        tester = self.make_tester(logger=logger)
+        result = tester._gather_test_output(
+            ['test: test_failure', 'failure: test_failure',
+             'test: test_success', 'successful: test_success'],
+            logger)
+        self.assertEquals(2, result.testsRun)
+        self.assertEquals(1, len(result.failures))
+
 
 class TestPidfileHelpers(TestCase):
     """Tests for `write_pidfile` and `remove_pidfile`."""