Merge lp://staging/~cprov/launchpad/bug-424797-buildd-manager-test-failure into lp://staging/launchpad

Proposed by Celso Providelo
Status: Merged
Approved by: Jonathan Lange
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp://staging/~cprov/launchpad/bug-424797-buildd-manager-test-failure
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~cprov/launchpad/bug-424797-buildd-manager-test-failure
Reviewer Review Type Date Requested Status
Jonathan Lange (community) code Approve
Canonical Launchpad Engineering Pending
Review via email: mp+11275@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

reviewer jml

= Summary =

This branch fixes https://bugs.edge.launchpad.net/soyuz/+bug/424797

As reported in the bug, It was originally caused by a change in sampledata. However it is quite intriguing to see failures like that being 'swallowed' in our test suite.

It turns out that currently any failures/errors on trial.unittest.TestCase are ignored.

{{{
class TestTrial(TrialTestCase):

    def test_swallowed_errors(self):
        self.assertEquals(1, 2)
}}}

{{{
$ ./bin/test -vv -t TestTrial
Running tests at level 1
Running zope.testing.testrunner.layer.UnitTests tests:
  Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
  Running:
 test_swallowed_errors (lp.buildmaster.tests.test_manager.TestTrial)

Failure in test test_swallowed_errors (lp.buildmaster.tests.test_manager.TestTrial)

  Ran 1 tests with 0 failures and 0 errors in 0.009 seconds.
Tearing down left over layers:
  Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
}}}

This is currently happening in buildbot, so I assume it's not a *karmic* issue.

Ideally I would like to have the specific test fixing (contained in the branch) and the trial-related fixes landed separately, but if it's simple enough I don't mind mixing both.

== Tests ==

/bin/test -vv -t testScanRescuesJobFromBrokenBuilder

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/buildmaster/tests/test_manager.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqkA78ACgkQ7KBXuXyZSjAIPACeOwhX0/FCWxeYJAgrzf2kjlAq
qJUAmgMZAEz7WBsrX/n6q2uV9lotnm08
=G72k
-----END PGP SIGNATURE-----

Revision history for this message
Jonathan Lange (jml) wrote :

Hey Celso,

Your change to the test looks clear & correct, and I'm happy for it to land.

The fix for the "failing silently" bit is actually going to be reasonably complex, so it's fair enough to deal with it in another branch. Bug 425113 was filed to track it, and has a reasonable explanation of what's going on.

jml

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/buildmaster/tests/test_manager.py'
--- lib/lp/buildmaster/tests/test_manager.py 2009-06-25 00:46:29 +0000
+++ lib/lp/buildmaster/tests/test_manager.py 2009-09-06 18:33:27 +0000
@@ -597,18 +597,23 @@
597 def testScanRescuesJobFromBrokenBuilder(self):597 def testScanRescuesJobFromBrokenBuilder(self):
598 # The job assigned to a broken builder is rescued.598 # The job assigned to a broken builder is rescued.
599599
600 # Sampledata builder is broken and is holding a active job.600 # Sampledata builder is enabled and is assigned to an active job.
601 broken_builder = getUtility(IBuilderSet)['bob']601 builder = getUtility(IBuilderSet)['bob']
602 self.assertFalse(broken_builder.builderok)602 self.assertTrue(builder.builderok)
603 lost_job = broken_builder.currentjob603 job = builder.currentjob
604 self.assertTrue(lost_job is not None)604 self.assertBuildingJob(job, builder)
605 self.assertBuildingJob(lost_job, broken_builder)605
606 # Disable the sampledata builder
607 login('foo.bar@canonical.com')
608 builder.builderok = False
609 transaction.commit()
610 login(ANONYMOUS)
606611
607 # Run 'scan' and check its result.612 # Run 'scan' and check its result.
608 LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser)613 LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser)
609 manager = self._getManager()614 manager = self._getManager()
610 d = defer.maybeDeferred(manager.scan)615 d = defer.maybeDeferred(manager.scan)
611 d.addCallback(self._checkJobRescued, broken_builder, lost_job)616 d.addCallback(self._checkJobRescued, builder, job)
612 return d617 return d
613618
614 def _checkJobUpdated(self, recording_slaves, builder, job):619 def _checkJobUpdated(self, recording_slaves, builder, job):