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
1=== modified file 'lib/lp/registry/interfaces/distroseries.py'
2--- lib/lp/registry/interfaces/distroseries.py 2011-08-18 03:55:10 +0000
3+++ lib/lp/registry/interfaces/distroseries.py 2011-08-22 16:27:32 +0000
4@@ -990,9 +990,9 @@
5 )
6 @call_with(user=REQUEST_USER)
7 @export_write_operation()
8- def initDerivedDistroSeries(user, parents, architectures,
9- packagesets, rebuild, overlays,
10- overlay_pockets, overlay_components):
11+ def initDerivedDistroSeries(user, parents, architectures=[],
12+ packagesets=[], rebuild=False, overlays=[],
13+ overlay_pockets=[], overlay_components=[]):
14 """Initialize this series from parents.
15
16 This method performs checks and then creates a job to populate
17
18=== modified file 'lib/lp/soyuz/model/queue.py'
19--- lib/lp/soyuz/model/queue.py 2011-08-16 16:11:16 +0000
20+++ lib/lp/soyuz/model/queue.py 2011-08-22 16:27:32 +0000
21@@ -1446,13 +1446,12 @@
22 names=None):
23 """See `IPackageUploadSet`."""
24 # Avoiding circular imports.
25- from lp.registry.model.distroseries import DistroSeries
26 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
27 from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
28
29 archives = distroseries.distribution.getArchiveIDList()
30 clauses = [
31- DistroSeries.id == PackageUpload.distroseriesID,
32+ PackageUpload.distroseries == distroseries,
33 PackageUpload.archiveID.is_in(archives),
34 PackageUploadBuild.packageuploadID == PackageUpload.id,
35 ]
36
37=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
38--- lib/lp/soyuz/scripts/initialize_distroseries.py 2011-08-19 12:03:39 +0000
39+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2011-08-22 16:27:32 +0000
40@@ -160,7 +160,6 @@
41 self._checkBuilds(parent)
42 self._checkQueue(parent)
43 self._checkSeries()
44- return True
45
46 def _checkParents(self):
47 """If self.first_derivation, the parents list cannot be empty."""
48
49=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
50--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2011-08-22 16:27:31 +0000
51+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2011-08-22 16:27:32 +0000
52@@ -243,7 +243,8 @@
53 child = self.factory.makeDistroSeries(
54 distribution=self.parent.parent, previous_series=self.parent)
55 ids = InitializeDistroSeries(child, [self.parent.id])
56- self.assertTrue(ids.check())
57+ # No exception should be raised.
58+ ids.check()
59
60 def test_failure_with_pending_builds_specific_arches(self):
61 # We only check for pending builds of the same architectures we're
62@@ -265,6 +266,23 @@
63 "see help text for more information."),
64 ids.check)
65
66+ def test_check_success_with_build_in_other_series(self):
67+ # Builds in the child's archive but in another series do not
68+ # prevent the initialization of child.
69+ parent, unused = self.setupParent()
70+ other_series, unused = self.setupParent(
71+ distribution=parent.distribution)
72+ upload = other_series.createQueueEntry(
73+ PackagePublishingPocket.RELEASE,
74+ other_series.main_archive, 'foo.changes', 'bar')
75+ # Create a binary package upload for this upload.
76+ upload.addBuild(self.factory.makeBinaryPackageBuild())
77+ child = self.factory.makeDistroSeries()
78+ ids = InitializeDistroSeries(child, [parent.id])
79+
80+ # No exception should be raised.
81+ ids.check()
82+
83 def test_check_success_with_pending_builds_in_other_arches(self):
84 # We only check for pending builds of the same architectures we're
85 # copying over from the parents. If *no* build is present in the
86@@ -281,7 +299,7 @@
87
88 # No error is raised because we're initializing only the architecture
89 # which has no pending builds in it.
90- self.assertTrue(ids.check())
91+ ids.check()
92
93 def test_failure_if_build_present_in_selected_packagesets(self):
94 # Pending builds in a parent for source packages included in the
95@@ -317,7 +335,8 @@
96 ids = InitializeDistroSeries(
97 child, packagesets=(str(packageset2.id),))
98
99- self.assertTrue(ids.check())
100+ # No exception should be raised.
101+ ids.check()
102
103 def test_success_with_updates_packages(self):
104 # Initialization copies all the package from the UPDATES pocket.
105@@ -395,7 +414,8 @@
106 child = self.factory.makeDistroSeries()
107 ids = InitializeDistroSeries(child, [parent.id])
108
109- self.assertTrue(ids.check())
110+ # No exception should be raised.
111+ ids.check()
112
113 def test_failure_with_binary_queue_items_pockets(self):
114 # If the parent series has binary items in pockets RELEASE,
115@@ -465,7 +485,8 @@
116 child = self.factory.makeDistroSeries()
117 ids = InitializeDistroSeries(child, [parent.id])
118
119- self.assertTrue(ids.check())
120+ # No exception should be raised.
121+ ids.check()
122
123 def test_check_success_with_source_queue_items(self):
124 # If the parent series has *source* items in its queues, we
125@@ -479,7 +500,8 @@
126 child = self.factory.makeDistroSeries()
127 ids = InitializeDistroSeries(child, [parent.id])
128
129- self.assertTrue(ids.check())
130+ # No exception should be raised.
131+ ids.check()
132
133 def test_check_success_with_binary_queue_items_outside_packagesets(self):
134 # If the parent series has binary items in its queues not in the
135@@ -504,7 +526,8 @@
136 ids = InitializeDistroSeries(child, [parent.id],
137 child, packagesets=(str(packageset1.id),))
138
139- self.assertTrue(ids.check())
140+ # No exception should be raised.
141+ ids.check()
142
143 def test_failure_with_binary_queue_items_in_packagesets(self):
144 # If the parent series has binary items in its queues in the