Merge lp:~rvb/launchpad/queue-bug-830983 into lp:launchpad

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 13763
Proposed branch: lp:~rvb/launchpad/queue-bug-830983
Merge into: lp:launchpad
Prerequisite: lp:~rvb/launchpad/ids-fix
Diff against target: 144 lines (+34/-13)
4 files modified
lib/lp/registry/interfaces/distroseries.py (+3/-3)
lib/lp/soyuz/model/queue.py (+1/-2)
lib/lp/soyuz/scripts/initialize_distroseries.py (+0/-1)
lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py (+30/-7)
To merge this branch: bzr merge lp:~rvb/launchpad/queue-bug-830983
Reviewer Review Type Date Requested Status
Henning Eggers (community) Approve
Review via email: mp+72406@code.launchpad.net

Commit message

[r=henninge][bug=830983] Fix how we check for builds in lib/lp/soyuz/model/queue.py getBuildsForSources to only check inside the given distroseries.

Description of the change

This branch fixes how we check for builds in lib/lp/soyuz/model/queue.py getBuildsForSources to only check inside the given distroseries.

= Tests =

./bin/test -vvc test_initialize_distroseries test_check_success_with_build_in_other_series

= QA =

I'll land this with no-qa because the QA for this will be part of the QA in progress for 820452.

To post a comment you must log in.
Revision history for this message
Henning Eggers (henninge) wrote :

As discussed on IRC, please be explicit about the fact that you are testing for the absence of Exception being raised. No need for fake "return True" and "assertTrue".

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2011-08-18 03:55:10 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2011-08-22 16:27:32 +0000
@@ -990,9 +990,9 @@
990 )990 )
991 @call_with(user=REQUEST_USER)991 @call_with(user=REQUEST_USER)
992 @export_write_operation()992 @export_write_operation()
993 def initDerivedDistroSeries(user, parents, architectures,993 def initDerivedDistroSeries(user, parents, architectures=[],
994 packagesets, rebuild, overlays,994 packagesets=[], rebuild=False, overlays=[],
995 overlay_pockets, overlay_components):995 overlay_pockets=[], overlay_components=[]):
996 """Initialize this series from parents.996 """Initialize this series from parents.
997997
998 This method performs checks and then creates a job to populate998 This method performs checks and then creates a job to populate
999999
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2011-08-16 16:11:16 +0000
+++ lib/lp/soyuz/model/queue.py 2011-08-22 16:27:32 +0000
@@ -1446,13 +1446,12 @@
1446 names=None):1446 names=None):
1447 """See `IPackageUploadSet`."""1447 """See `IPackageUploadSet`."""
1448 # Avoiding circular imports.1448 # Avoiding circular imports.
1449 from lp.registry.model.distroseries import DistroSeries
1450 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild1449 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
1451 from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease1450 from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
14521451
1453 archives = distroseries.distribution.getArchiveIDList()1452 archives = distroseries.distribution.getArchiveIDList()
1454 clauses = [1453 clauses = [
1455 DistroSeries.id == PackageUpload.distroseriesID,1454 PackageUpload.distroseries == distroseries,
1456 PackageUpload.archiveID.is_in(archives),1455 PackageUpload.archiveID.is_in(archives),
1457 PackageUploadBuild.packageuploadID == PackageUpload.id,1456 PackageUploadBuild.packageuploadID == PackageUpload.id,
1458 ]1457 ]
14591458
=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py 2011-08-19 12:03:39 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2011-08-22 16:27:32 +0000
@@ -160,7 +160,6 @@
160 self._checkBuilds(parent)160 self._checkBuilds(parent)
161 self._checkQueue(parent)161 self._checkQueue(parent)
162 self._checkSeries()162 self._checkSeries()
163 return True
164163
165 def _checkParents(self):164 def _checkParents(self):
166 """If self.first_derivation, the parents list cannot be empty."""165 """If self.first_derivation, the parents list cannot be empty."""
167166
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2011-08-22 16:27:31 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2011-08-22 16:27:32 +0000
@@ -243,7 +243,8 @@
243 child = self.factory.makeDistroSeries(243 child = self.factory.makeDistroSeries(
244 distribution=self.parent.parent, previous_series=self.parent)244 distribution=self.parent.parent, previous_series=self.parent)
245 ids = InitializeDistroSeries(child, [self.parent.id])245 ids = InitializeDistroSeries(child, [self.parent.id])
246 self.assertTrue(ids.check())246 # No exception should be raised.
247 ids.check()
247248
248 def test_failure_with_pending_builds_specific_arches(self):249 def test_failure_with_pending_builds_specific_arches(self):
249 # We only check for pending builds of the same architectures we're250 # We only check for pending builds of the same architectures we're
@@ -265,6 +266,23 @@
265 "see help text for more information."),266 "see help text for more information."),
266 ids.check)267 ids.check)
267268
269 def test_check_success_with_build_in_other_series(self):
270 # Builds in the child's archive but in another series do not
271 # prevent the initialization of child.
272 parent, unused = self.setupParent()
273 other_series, unused = self.setupParent(
274 distribution=parent.distribution)
275 upload = other_series.createQueueEntry(
276 PackagePublishingPocket.RELEASE,
277 other_series.main_archive, 'foo.changes', 'bar')
278 # Create a binary package upload for this upload.
279 upload.addBuild(self.factory.makeBinaryPackageBuild())
280 child = self.factory.makeDistroSeries()
281 ids = InitializeDistroSeries(child, [parent.id])
282
283 # No exception should be raised.
284 ids.check()
285
268 def test_check_success_with_pending_builds_in_other_arches(self):286 def test_check_success_with_pending_builds_in_other_arches(self):
269 # We only check for pending builds of the same architectures we're287 # We only check for pending builds of the same architectures we're
270 # copying over from the parents. If *no* build is present in the288 # copying over from the parents. If *no* build is present in the
@@ -281,7 +299,7 @@
281299
282 # No error is raised because we're initializing only the architecture300 # No error is raised because we're initializing only the architecture
283 # which has no pending builds in it.301 # which has no pending builds in it.
284 self.assertTrue(ids.check())302 ids.check()
285303
286 def test_failure_if_build_present_in_selected_packagesets(self):304 def test_failure_if_build_present_in_selected_packagesets(self):
287 # Pending builds in a parent for source packages included in the305 # Pending builds in a parent for source packages included in the
@@ -317,7 +335,8 @@
317 ids = InitializeDistroSeries(335 ids = InitializeDistroSeries(
318 child, packagesets=(str(packageset2.id),))336 child, packagesets=(str(packageset2.id),))
319337
320 self.assertTrue(ids.check())338 # No exception should be raised.
339 ids.check()
321340
322 def test_success_with_updates_packages(self):341 def test_success_with_updates_packages(self):
323 # Initialization copies all the package from the UPDATES pocket.342 # Initialization copies all the package from the UPDATES pocket.
@@ -395,7 +414,8 @@
395 child = self.factory.makeDistroSeries()414 child = self.factory.makeDistroSeries()
396 ids = InitializeDistroSeries(child, [parent.id])415 ids = InitializeDistroSeries(child, [parent.id])
397416
398 self.assertTrue(ids.check())417 # No exception should be raised.
418 ids.check()
399419
400 def test_failure_with_binary_queue_items_pockets(self):420 def test_failure_with_binary_queue_items_pockets(self):
401 # If the parent series has binary items in pockets RELEASE,421 # If the parent series has binary items in pockets RELEASE,
@@ -465,7 +485,8 @@
465 child = self.factory.makeDistroSeries()485 child = self.factory.makeDistroSeries()
466 ids = InitializeDistroSeries(child, [parent.id])486 ids = InitializeDistroSeries(child, [parent.id])
467487
468 self.assertTrue(ids.check())488 # No exception should be raised.
489 ids.check()
469490
470 def test_check_success_with_source_queue_items(self):491 def test_check_success_with_source_queue_items(self):
471 # If the parent series has *source* items in its queues, we492 # If the parent series has *source* items in its queues, we
@@ -479,7 +500,8 @@
479 child = self.factory.makeDistroSeries()500 child = self.factory.makeDistroSeries()
480 ids = InitializeDistroSeries(child, [parent.id])501 ids = InitializeDistroSeries(child, [parent.id])
481502
482 self.assertTrue(ids.check())503 # No exception should be raised.
504 ids.check()
483505
484 def test_check_success_with_binary_queue_items_outside_packagesets(self):506 def test_check_success_with_binary_queue_items_outside_packagesets(self):
485 # If the parent series has binary items in its queues not in the507 # If the parent series has binary items in its queues not in the
@@ -504,7 +526,8 @@
504 ids = InitializeDistroSeries(child, [parent.id],526 ids = InitializeDistroSeries(child, [parent.id],
505 child, packagesets=(str(packageset1.id),))527 child, packagesets=(str(packageset1.id),))
506528
507 self.assertTrue(ids.check())529 # No exception should be raised.
530 ids.check()
508531
509 def test_failure_with_binary_queue_items_in_packagesets(self):532 def test_failure_with_binary_queue_items_in_packagesets(self):
510 # If the parent series has binary items in its queues in the533 # If the parent series has binary items in its queues in the