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
1=== modified file 'lib/lp/buildmaster/tests/test_manager.py'
2--- lib/lp/buildmaster/tests/test_manager.py 2009-06-25 00:46:29 +0000
3+++ lib/lp/buildmaster/tests/test_manager.py 2009-09-06 18:33:27 +0000
4@@ -597,18 +597,23 @@
5 def testScanRescuesJobFromBrokenBuilder(self):
6 # The job assigned to a broken builder is rescued.
7
8- # Sampledata builder is broken and is holding a active job.
9- broken_builder = getUtility(IBuilderSet)['bob']
10- self.assertFalse(broken_builder.builderok)
11- lost_job = broken_builder.currentjob
12- self.assertTrue(lost_job is not None)
13- self.assertBuildingJob(lost_job, broken_builder)
14+ # Sampledata builder is enabled and is assigned to an active job.
15+ builder = getUtility(IBuilderSet)['bob']
16+ self.assertTrue(builder.builderok)
17+ job = builder.currentjob
18+ self.assertBuildingJob(job, builder)
19+
20+ # Disable the sampledata builder
21+ login('foo.bar@canonical.com')
22+ builder.builderok = False
23+ transaction.commit()
24+ login(ANONYMOUS)
25
26 # Run 'scan' and check its result.
27 LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser)
28 manager = self._getManager()
29 d = defer.maybeDeferred(manager.scan)
30- d.addCallback(self._checkJobRescued, broken_builder, lost_job)
31+ d.addCallback(self._checkJobRescued, builder, job)
32 return d
33
34 def _checkJobUpdated(self, recording_slaves, builder, job):