10130.7.2
by Jonathan Lange
Initial recipe builder behaviour stuff. |
1 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
10130.7.34
by Jelmer Vernooij
review feedback from jono. |
4 |
"""Test RecipeBuildBehavior."""
|
10130.7.2
by Jonathan Lange
Initial recipe builder behaviour stuff. |
5 |
|
10498.5.31
by Aaron Bentley
Lint fixes. |
6 |
# pylint: disable-msg=F0401
|
7 |
||
10130.7.2
by Jonathan Lange
Initial recipe builder behaviour stuff. |
8 |
__metaclass__ = type |
9 |
||
12070.1.44
by Tim Penhey
Fix more change fallout in the tests. |
10 |
from textwrap import dedent |
11 |
import transaction |
|
12 |
||
11705.2.3
by Jonathan Lange
More places that don't need twisted.trial |
13 |
from testtools import run_test_with |
14 |
from testtools.deferredruntest import ( |
|
15 |
assert_fails_with, |
|
16 |
AsynchronousDeferredRunTest, |
|
17 |
)
|
|
12070.1.44
by Tim Penhey
Fix more change fallout in the tests. |
18 |
from testtools.matchers import StartsWith |
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
19 |
from twisted.internet import defer |
10677.2.1
by Jeroen Vermeulen
Replace slave build id with slave build cookie. |
20 |
from zope.security.proxy import removeSecurityProxy |
21 |
||
11666.3.5
by Curtis Hovey
Import layers from canonical.testing.layers. |
22 |
from canonical.testing.layers import ( |
7675.1069.13
by Julian Edwards
fix failing TestRecipeBuilder tests |
23 |
LaunchpadZopelessLayer, |
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
24 |
)
|
11458.1.2
by Jelmer Vernooij
Move BuildFarmJobType to lp.buildmaster.enums. |
25 |
from lp.buildmaster.enums import BuildFarmJobType |
10130.7.22
by Jelmer Vernooij
Fix warnings, add test verifying that dispatching fails when there's no chroot. |
26 |
from lp.buildmaster.interfaces.builder import CannotBuild |
10130.7.2
by Jonathan Lange
Initial recipe builder behaviour stuff. |
27 |
from lp.buildmaster.interfaces.buildfarmjobbehavior import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
28 |
IBuildFarmJobBehavior, |
29 |
)
|
|
10677.2.1
by Jeroen Vermeulen
Replace slave build id with slave build cookie. |
30 |
from lp.buildmaster.model.buildqueue import BuildQueue |
11593.2.1
by Julian Edwards
move lib/lp/soyuz/tests/soyuzbuilddhelpers.py => lib/lp/buildmaster/tests/mock_slaves.py |
31 |
from lp.buildmaster.tests.mock_slaves import ( |
32 |
MockBuilder, |
|
33 |
OkSlave, |
|
34 |
)
|
|
10130.12.24
by Michael Nelson
Fixed one import that the regex didn't catch. |
35 |
from lp.code.model.recipebuilder import RecipeBuildBehavior |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
36 |
from lp.code.model.sourcepackagerecipebuild import SourcePackageRecipeBuild |
10855.1.1
by Aaron Bentley
Fix verifyBuildRequest to use valid attribute |
37 |
from lp.registry.interfaces.pocket import PackagePublishingPocket |
12070.1.5
by Tim Penhey
Update imports for the BufferLogger. |
38 |
from lp.services.log.logger import BufferLogger |
10677.2.1
by Jeroen Vermeulen
Replace slave build id with slave build cookie. |
39 |
from lp.soyuz.adapters.archivedependencies import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
40 |
get_sources_list_for_building, |
41 |
)
|
|
7675.502.31
by Jonathan Lange
Various test fixes |
42 |
from lp.soyuz.model.processor import ProcessorFamilySet |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
43 |
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
44 |
from lp.testing import ( |
|
45 |
person_logged_in, |
|
46 |
TestCaseWithFactory, |
|
47 |
)
|
|
11705.2.3
by Jonathan Lange
More places that don't need twisted.trial |
48 |
|
49 |
||
50 |
class TestRecipeBuilder(TestCaseWithFactory): |
|
51 |
||
7675.1069.13
by Julian Edwards
fix failing TestRecipeBuilder tests |
52 |
layer = LaunchpadZopelessLayer |
10130.7.2
by Jonathan Lange
Initial recipe builder behaviour stuff. |
53 |
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
54 |
def makeJob(self, recipe_registrant=None, recipe_owner=None): |
10130.7.25
by Jelmer Vernooij
feedback from jml |
55 |
"""Create a sample `ISourcePackageRecipeBuildJob`."""
|
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
56 |
spn = self.factory.makeSourcePackageName("apackage") |
57 |
distro = self.factory.makeDistribution(name="distro") |
|
7675.502.26
by Jonathan Lange
Merge db-stable |
58 |
distroseries = self.factory.makeDistroSeries(name="mydistro", |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
59 |
distribution=distro) |
7675.502.31
by Jonathan Lange
Various test fixes |
60 |
processorfamily = ProcessorFamilySet().getByProcessorName('386') |
61 |
distroseries.newArch( |
|
7675.502.37
by Jonathan Lange
Niggle |
62 |
'i386', processorfamily, True, self.factory.makePerson()) |
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
63 |
sourcepackage = self.factory.makeSourcePackage(spn, distroseries) |
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
64 |
if recipe_registrant is None: |
65 |
recipe_registrant = self.factory.makePerson( |
|
66 |
email="requester@ubuntu.com", |
|
67 |
name="joe", displayname="Joe User") |
|
68 |
if recipe_owner is None: |
|
69 |
recipe_owner = recipe_registrant |
|
70 |
somebranch = self.factory.makeBranch( |
|
71 |
owner=recipe_owner, name="pkg", |
|
10130.7.20
by Jelmer Vernooij
Merge Michaels branch. |
72 |
product=self.factory.makeProduct("someapp")) |
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
73 |
recipe = self.factory.makeSourcePackageRecipe( |
74 |
recipe_registrant, recipe_owner, distroseries, u"recept", |
|
75 |
u"Recipe description", branches=[somebranch]) |
|
7675.502.31
by Jonathan Lange
Various test fixes |
76 |
spb = self.factory.makeSourcePackageRecipeBuild( |
7675.984.8
by Aaron Bentley
Fix lint. |
77 |
sourcepackage=sourcepackage, |
78 |
recipe=recipe, requester=recipe_owner, distroseries=distroseries) |
|
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
79 |
job = spb.makeJob() |
10677.2.1
by Jeroen Vermeulen
Replace slave build id with slave build cookie. |
80 |
job_id = removeSecurityProxy(job.job).id |
81 |
BuildQueue(job_type=BuildFarmJobType.RECIPEBRANCHBUILD, job=job_id) |
|
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
82 |
job = IBuildFarmJobBehavior(job) |
83 |
return job |
|
84 |
||
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
85 |
def test_providesInterface(self): |
86 |
# RecipeBuildBehavior provides IBuildFarmJobBehavior.
|
|
87 |
recipe_builder = RecipeBuildBehavior(None) |
|
88 |
self.assertProvides(recipe_builder, IBuildFarmJobBehavior) |
|
89 |
||
90 |
def test_adapts_ISourcePackageRecipeBuildJob(self): |
|
91 |
# IBuildFarmJobBehavior adapts a ISourcePackageRecipeBuildJob
|
|
92 |
job = self.factory.makeSourcePackageRecipeBuild().makeJob() |
|
93 |
job = IBuildFarmJobBehavior(job) |
|
94 |
self.assertProvides(job, IBuildFarmJobBehavior) |
|
95 |
||
10130.7.25
by Jelmer Vernooij
feedback from jml |
96 |
def test_display_name(self): |
97 |
# display_name contains a sane description of the job
|
|
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
98 |
job = self.makeJob() |
10130.7.25
by Jelmer Vernooij
feedback from jml |
99 |
self.assertEquals(job.display_name, |
7675.700.6
by Paul Hummer
Fixed the tests |
100 |
"Mydistro, recept, joe") |
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
101 |
|
102 |
def test_logStartBuild(self): |
|
10130.7.25
by Jelmer Vernooij
feedback from jml |
103 |
# logStartBuild will properly report the package that's being built
|
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
104 |
job = self.makeJob() |
105 |
logger = BufferLogger() |
|
106 |
job.logStartBuild(logger) |
|
12070.1.44
by Tim Penhey
Fix more change fallout in the tests. |
107 |
self.assertEquals(logger.getLogBuffer(), |
108 |
"INFO startBuild(Mydistro, recept, joe)\n") |
|
10130.7.14
by Jelmer Vernooij
Implement RecipeBuilder.logStartBuild. |
109 |
|
10130.7.15
by Jelmer Vernooij
wip. |
110 |
def test_verifyBuildRequest_valid(self): |
10130.7.25
by Jelmer Vernooij
feedback from jml |
111 |
# VerifyBuildRequest won't raise any exceptions when called with a
|
112 |
# valid builder set.
|
|
10130.7.15
by Jelmer Vernooij
wip. |
113 |
job = self.makeJob() |
10430.8.5
by William Grant
Drop all the rescueIfLost-test-specific mock slaves, use a special build behavior in the rIL test, and fix other tests that used the late mocks. |
114 |
builder = MockBuilder("bob-de-bouwer", OkSlave()) |
10130.7.15
by Jelmer Vernooij
wip. |
115 |
job.setBuilder(builder) |
116 |
logger = BufferLogger() |
|
117 |
job.verifyBuildRequest(logger) |
|
12070.1.44
by Tim Penhey
Fix more change fallout in the tests. |
118 |
self.assertEquals("", logger.getLogBuffer()) |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
119 |
|
10855.1.1
by Aaron Bentley
Fix verifyBuildRequest to use valid attribute |
120 |
def test_verifyBuildRequest_non_virtual(self): |
121 |
# verifyBuildRequest will raise if a non-virtual builder is proposed.
|
|
122 |
job = self.makeJob() |
|
123 |
builder = MockBuilder('non-virtual builder', OkSlave()) |
|
124 |
builder.virtualized = False |
|
125 |
job.setBuilder(builder) |
|
126 |
logger = BufferLogger() |
|
127 |
e = self.assertRaises(AssertionError, job.verifyBuildRequest, logger) |
|
128 |
self.assertEqual( |
|
129 |
'Attempt to build virtual item on a non-virtual builder.', str(e)) |
|
130 |
||
131 |
def test_verifyBuildRequest_bad_pocket(self): |
|
132 |
# verifyBuildRequest will raise if a bad pocket is proposed.
|
|
133 |
build = self.factory.makeSourcePackageRecipeBuild( |
|
134 |
pocket=PackagePublishingPocket.SECURITY) |
|
135 |
job = self.factory.makeSourcePackageRecipeBuildJob(recipe_build=build) |
|
136 |
job = IBuildFarmJobBehavior(job.specific_job) |
|
137 |
job.setBuilder(MockBuilder("bob-de-bouwer", OkSlave())) |
|
138 |
e = self.assertRaises( |
|
139 |
AssertionError, job.verifyBuildRequest, BufferLogger()) |
|
140 |
self.assertIn('invalid pocket due to the series status of', str(e)) |
|
141 |
||
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
142 |
def _setBuilderConfig(self): |
143 |
"""Setup a temporary builder config."""
|
|
144 |
self.pushConfig( |
|
145 |
"builddmaster", |
|
146 |
bzr_builder_sources_list="deb http://foo %(series)s main") |
|
147 |
||
148 |
def test_extraBuildArgs(self): |
|
10130.7.25
by Jelmer Vernooij
feedback from jml |
149 |
# _extraBuildArgs will return a sane set of additional arguments
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
150 |
self._setBuilderConfig() |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
151 |
job = self.makeJob() |
10130.7.29
by Jelmer Vernooij
Fix providing sources lists. |
152 |
distroarchseries = job.build.distroseries.architectures[0] |
10795.2.2
by Julian Edwards
Ensure that recipe builds send a configured sources.list to the slave for an archive that contains the bzr-builder package |
153 |
expected_archives = get_sources_list_for_building( |
7675.700.6
by Paul Hummer
Fixed the tests |
154 |
job.build, distroarchseries, None) |
10795.2.2
by Julian Edwards
Ensure that recipe builds send a configured sources.list to the slave for an archive that contains the bzr-builder package |
155 |
expected_archives.append( |
156 |
"deb http://foo %s main" % job.build.distroseries.name) |
|
7675.502.31
by Jonathan Lange
Various test fixes |
157 |
self.assertEqual({ |
11121.3.2
by William Grant
Send arch_tag for all existing job types, and fix broken tests. |
158 |
'arch_tag': 'i386', |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
159 |
'author_email': u'requester@ubuntu.com', |
160 |
'suite': u'mydistro', |
|
161 |
'author_name': u'Joe User', |
|
10130.7.20
by Jelmer Vernooij
Merge Michaels branch. |
162 |
'archive_purpose': 'PPA', |
10130.7.27
by Jelmer Vernooij
Provide ogrecomponent. |
163 |
'ogrecomponent': 'universe', |
11929.8.1
by Tim Penhey
Make the default recipe deb-version look like: {debupstream}-0~{revno} |
164 |
'recipe_text': |
7675.984.13
by Aaron Bentley
Merged nest-part-model into allow-0.3-2 |
165 |
'# bzr-builder format 0.3 deb-version {debupstream}-0~{revno}\n' |
11929.8.1
by Tim Penhey
Make the default recipe deb-version look like: {debupstream}-0~{revno} |
166 |
'lp://dev/~joe/someapp/pkg\n', |
10795.2.2
by Julian Edwards
Ensure that recipe builds send a configured sources.list to the slave for an archive that contains the bzr-builder package |
167 |
'archives': expected_archives, |
10739.2.4
by Aaron Bentley
Updates from review. |
168 |
'distroseries_name': job.build.distroseries.name, |
10130.7.29
by Jelmer Vernooij
Fix providing sources lists. |
169 |
}, job._extraBuildArgs(distroarchseries)) |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
170 |
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
171 |
def test_extraBuildArgs_team_owner_no_email(self): |
172 |
# If the owner of the recipe is a team without a preferred email, the
|
|
173 |
# registrant is used.
|
|
174 |
self._setBuilderConfig() |
|
175 |
recipe_registrant = self.factory.makePerson( |
|
7675.984.8
by Aaron Bentley
Fix lint. |
176 |
name='eric', displayname='Eric the Viking', |
177 |
email='eric@vikings.r.us') |
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
178 |
recipe_owner = self.factory.makeTeam( |
179 |
name='vikings', members=[recipe_registrant]) |
|
180 |
||
181 |
job = self.makeJob(recipe_registrant, recipe_owner) |
|
182 |
distroarchseries = job.build.distroseries.architectures[0] |
|
183 |
extra_args = job._extraBuildArgs(distroarchseries) |
|
7675.984.8
by Aaron Bentley
Fix lint. |
184 |
self.assertEqual( |
185 |
"Launchpad Package Builder", extra_args['author_name']) |
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
186 |
self.assertEqual("noreply@launchpad.net", extra_args['author_email']) |
187 |
||
188 |
def test_extraBuildArgs_team_owner_with_email(self): |
|
189 |
# If the owner of the recipe is a team that has an email set, we use
|
|
190 |
# that.
|
|
191 |
self._setBuilderConfig() |
|
192 |
recipe_registrant = self.factory.makePerson() |
|
193 |
recipe_owner = self.factory.makeTeam( |
|
194 |
name='vikings', email='everyone@vikings.r.us', |
|
195 |
members=[recipe_registrant]) |
|
196 |
||
197 |
job = self.makeJob(recipe_registrant, recipe_owner) |
|
198 |
distroarchseries = job.build.distroseries.architectures[0] |
|
199 |
extra_args = job._extraBuildArgs(distroarchseries) |
|
200 |
self.assertEqual("Vikings", extra_args['author_name']) |
|
201 |
self.assertEqual("everyone@vikings.r.us", extra_args['author_email']) |
|
202 |
||
203 |
def test_extraBuildArgs_owner_deactivated(self): |
|
204 |
# If the owner is deactivated, they have no preferred email.
|
|
205 |
self._setBuilderConfig() |
|
206 |
owner = self.factory.makePerson() |
|
207 |
with person_logged_in(owner): |
|
208 |
owner.deactivateAccount('deactivating') |
|
209 |
job = self.makeJob(owner) |
|
210 |
distroarchseries = job.build.distroseries.architectures[0] |
|
211 |
extra_args = job._extraBuildArgs(distroarchseries) |
|
7675.984.8
by Aaron Bentley
Fix lint. |
212 |
self.assertEqual( |
213 |
"Launchpad Package Builder", extra_args['author_name']) |
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
214 |
self.assertEqual("noreply@launchpad.net", extra_args['author_email']) |
215 |
||
10795.2.4
by Julian Edwards
Fixes suggested by noodles' review |
216 |
def test_extraBuildArgs_withBadConfigForBzrBuilderPPA(self): |
10795.2.3
by Julian Edwards
Add test for bad sources.list line |
217 |
# Ensure _extraBuildArgs doesn't blow up with a badly formatted
|
218 |
# bzr_builder_sources_list in the config.
|
|
11315.1.1
by Tim Penhey
Handle the case where there is not a preferred email set. |
219 |
self.pushConfig( |
220 |
"builddmaster", |
|
221 |
bzr_builder_sources_list="deb http://foo %(series) main") |
|
10795.2.3
by Julian Edwards
Add test for bad sources.list line |
222 |
# (note the missing 's' in %(series)
|
223 |
job = self.makeJob() |
|
224 |
distroarchseries = job.build.distroseries.architectures[0] |
|
225 |
expected_archives = get_sources_list_for_building( |
|
7675.700.6
by Paul Hummer
Fixed the tests |
226 |
job.build, distroarchseries, None) |
10795.2.3
by Julian Edwards
Add test for bad sources.list line |
227 |
logger = BufferLogger() |
228 |
self.assertEqual({ |
|
11121.3.2
by William Grant
Send arch_tag for all existing job types, and fix broken tests. |
229 |
'arch_tag': 'i386', |
10795.2.3
by Julian Edwards
Add test for bad sources.list line |
230 |
'author_email': u'requester@ubuntu.com', |
231 |
'suite': u'mydistro', |
|
232 |
'author_name': u'Joe User', |
|
233 |
'archive_purpose': 'PPA', |
|
234 |
'ogrecomponent': 'universe', |
|
11929.8.1
by Tim Penhey
Make the default recipe deb-version look like: {debupstream}-0~{revno} |
235 |
'recipe_text': |
7675.984.13
by Aaron Bentley
Merged nest-part-model into allow-0.3-2 |
236 |
'# bzr-builder format 0.3 deb-version {debupstream}-0~{revno}\n' |
11929.8.1
by Tim Penhey
Make the default recipe deb-version look like: {debupstream}-0~{revno} |
237 |
'lp://dev/~joe/someapp/pkg\n', |
10795.2.3
by Julian Edwards
Add test for bad sources.list line |
238 |
'archives': expected_archives, |
239 |
'distroseries_name': job.build.distroseries.name, |
|
240 |
}, job._extraBuildArgs(distroarchseries, logger)) |
|
241 |
self.assertIn( |
|
242 |
"Exception processing bzr_builder_sources_list:", |
|
12070.1.44
by Tim Penhey
Fix more change fallout in the tests. |
243 |
logger.getLogBuffer()) |
10795.2.3
by Julian Edwards
Add test for bad sources.list line |
244 |
|
10795.2.4
by Julian Edwards
Fixes suggested by noodles' review |
245 |
def test_extraBuildArgs_withNoBZrBuilderConfigSet(self): |
246 |
# Ensure _extraBuildArgs doesn't blow up when
|
|
247 |
# bzr_builder_sources_list isn't set.
|
|
248 |
job = self.makeJob() |
|
249 |
distroarchseries = job.build.distroseries.architectures[0] |
|
250 |
args = job._extraBuildArgs(distroarchseries) |
|
251 |
expected_archives = get_sources_list_for_building( |
|
7675.700.6
by Paul Hummer
Fixed the tests |
252 |
job.build, distroarchseries, None) |
10795.2.4
by Julian Edwards
Fixes suggested by noodles' review |
253 |
self.assertEqual(args["archives"], expected_archives) |
254 |
||
12961.1.1
by William Grant
SPRB.getById -> getByID. |
255 |
def test_getByID(self): |
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
256 |
job = self.makeJob() |
257 |
transaction.commit() |
|
258 |
self.assertEquals( |
|
12961.1.1
by William Grant
SPRB.getById -> getByID. |
259 |
job.build, SourcePackageRecipeBuild.getByID(job.build.id)) |
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
260 |
|
11705.2.3
by Jonathan Lange
More places that don't need twisted.trial |
261 |
@run_test_with(AsynchronousDeferredRunTest) |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
262 |
def test_dispatchBuildToSlave(self): |
10130.7.25
by Jelmer Vernooij
feedback from jml |
263 |
# Ensure dispatchBuildToSlave will make the right calls to the slave
|
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
264 |
job = self.makeJob() |
10130.7.22
by Jelmer Vernooij
Fix warnings, add test verifying that dispatching fails when there's no chroot. |
265 |
test_publisher = SoyuzTestPublisher() |
266 |
test_publisher.addFakeChroots(job.build.distroseries) |
|
11583.3.6
by Jonathan Lange
Use OkSlave rather than RecordingSlave to reduce the chances of interface |
267 |
slave = OkSlave() |
10130.7.21
by Jelmer Vernooij
Fix recipe builder tests. |
268 |
builder = MockBuilder("bob-de-bouwer", slave) |
10130.7.18
by Jelmer Vernooij
Further work on dispatchBuildToSlave. |
269 |
processorfamily = ProcessorFamilySet().getByProcessorName('386') |
270 |
builder.processor = processorfamily.processors[0] |
|
271 |
job.setBuilder(builder) |
|
272 |
logger = BufferLogger() |
|
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
273 |
d = defer.maybeDeferred(job.dispatchBuildToSlave, "someid", logger) |
7675.984.8
by Aaron Bentley
Fix lint. |
274 |
|
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
275 |
def check_dispatch(ignored): |
12070.1.44
by Tim Penhey
Fix more change fallout in the tests. |
276 |
self.assertThat( |
277 |
logger.getLogBuffer(), |
|
278 |
StartsWith(dedent("""\ |
|
279 |
INFO Sending chroot file for recipe build to bob-de-bouwer
|
|
280 |
INFO Initiating build 1-someid on http://fake:0000
|
|
281 |
"""))) |
|
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
282 |
self.assertEquals(["ensurepresent", "build"], |
283 |
[call[0] for call in slave.call_log]) |
|
284 |
build_args = slave.call_log[1][1:] |
|
285 |
self.assertEquals( |
|
286 |
build_args[0], job.buildfarmjob.generateSlaveBuildCookie()) |
|
287 |
self.assertEquals(build_args[1], "sourcepackagerecipe") |
|
288 |
self.assertEquals(build_args[3], []) |
|
289 |
distroarchseries = job.build.distroseries.architectures[0] |
|
7675.984.8
by Aaron Bentley
Fix lint. |
290 |
self.assertEqual( |
291 |
build_args[4], job._extraBuildArgs(distroarchseries)) |
|
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
292 |
return d.addCallback(check_dispatch) |
10130.7.15
by Jelmer Vernooij
wip. |
293 |
|
11705.2.3
by Jonathan Lange
More places that don't need twisted.trial |
294 |
@run_test_with(AsynchronousDeferredRunTest) |
10130.7.22
by Jelmer Vernooij
Fix warnings, add test verifying that dispatching fails when there's no chroot. |
295 |
def test_dispatchBuildToSlave_nochroot(self): |
7675.502.26
by Jonathan Lange
Merge db-stable |
296 |
# dispatchBuildToSlave will fail when there is not chroot tarball
|
10130.7.25
by Jelmer Vernooij
feedback from jml |
297 |
# available for the distroseries to build for.
|
10130.7.22
by Jelmer Vernooij
Fix warnings, add test verifying that dispatching fails when there's no chroot. |
298 |
job = self.makeJob() |
12001.3.16
by j.c.sackett
Updated more tests. |
299 |
test_publisher = SoyuzTestPublisher() |
10430.8.5
by William Grant
Drop all the rescueIfLost-test-specific mock slaves, use a special build behavior in the rIL test, and fix other tests that used the late mocks. |
300 |
builder = MockBuilder("bob-de-bouwer", OkSlave()) |
10130.7.22
by Jelmer Vernooij
Fix warnings, add test verifying that dispatching fails when there's no chroot. |
301 |
processorfamily = ProcessorFamilySet().getByProcessorName('386') |
302 |
builder.processor = processorfamily.processors[0] |
|
303 |
job.setBuilder(builder) |
|
304 |
logger = BufferLogger() |
|
11583.3.9
by Jonathan Lange
Make the test_recipebuilder tests expect Deferreds from dispatchBuild. |
305 |
d = defer.maybeDeferred(job.dispatchBuildToSlave, "someid", logger) |
11705.2.3
by Jonathan Lange
More places that don't need twisted.trial |
306 |
return assert_fails_with(d, CannotBuild) |