← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bfjb-from-bfj into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bfjb-from-bfj into lp:launchpad.

Commit message:
IBuildFarmJobBehaviors no longer need the IBuildFarmJobOld, so just give them the IBuildFarmJob instead.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bfjb-from-bfj/+merge/194805

IBuildFarmJobBehaviors no longer need the IBuildFarmJobOld, so just give them the IBuildFarmJob instead.

This makes the TTBB tests rather awkward, but that will be resolved as part of the disposal of TTBJ.
-- 
https://code.launchpad.net/~wgrant/launchpad/bfjb-from-bfj/+merge/194805
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bfjb-from-bfj into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py	2013-06-25 07:40:53 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py	2013-11-12 07:47:57 +0000
@@ -2095,7 +2095,7 @@
 
         # Commit so the build cookie has the right ids.
         self.layer.txn.commit()
-        behavior = IBuildFarmJobBehavior(build.buildqueue_record.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         leaf_name = behavior.getUploadDirLeaf(behavior.getBuildCookie())
         os.mkdir(os.path.join(self.incoming_folder, leaf_name))
         self.options.context = 'buildd'
@@ -2138,7 +2138,7 @@
 
         # Commit so the build cookie has the right ids.
         self.layer.txn.commit()
-        behavior = IBuildFarmJobBehavior(build.buildqueue_record.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         leaf_name = behavior.getUploadDirLeaf(behavior.getBuildCookie())
         upload_dir = self.queueUpload("bar_1.0-1_binary",
                 queue_entry=leaf_name)
@@ -2163,11 +2163,10 @@
             distroseries=self.breezy, archive=archive,
             requester=archive.owner)
         self.assertEquals(archive.owner, build.requester)
-        bq = self.factory.makeSourcePackageRecipeBuildJob(recipe_build=build)
         self.switchToUploader()
         # Commit so the build cookie has the right ids.
         self.layer.txn.commit()
-        behavior = IBuildFarmJobBehavior(bq.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         leaf_name = behavior.getUploadDirLeaf(behavior.getBuildCookie())
         relative_path = "~%s/%s/%s/%s" % (
             archive.owner.name, archive.name, self.breezy.distribution.name,
@@ -2211,10 +2210,9 @@
         archive.require_virtualized = False
         build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar",
             distroseries=self.breezy, archive=archive)
-        bq = self.factory.makeSourcePackageRecipeBuildJob(recipe_build=build)
         # Commit so the build cookie has the right ids.
         Store.of(build).flush()
-        behavior = IBuildFarmJobBehavior(bq.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         leaf_name = behavior.getUploadDirLeaf(behavior.getBuildCookie())
         os.mkdir(os.path.join(self.incoming_folder, leaf_name))
         self.options.context = 'buildd'
@@ -2255,11 +2253,10 @@
         archive.require_virtualized = False
         build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar",
             distroseries=self.breezy, archive=archive)
-        bq = self.factory.makeSourcePackageRecipeBuildJob(recipe_build=build)
         self.switchToUploader()
         # Commit so the build cookie has the right ids.
         Store.of(build).flush()
-        behavior = IBuildFarmJobBehavior(bq.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         leaf_name = behavior.getUploadDirLeaf(behavior.getBuildCookie())
         os.mkdir(os.path.join(self.incoming_folder, leaf_name))
         self.options.context = 'buildd'
@@ -2307,7 +2304,7 @@
 
         # Commit so the build cookie has the right ids.
         self.layer.txn.commit()
-        behavior = IBuildFarmJobBehavior(build.buildqueue_record.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         leaf_name = behavior.getUploadDirLeaf(behavior.getBuildCookie())
         upload_dir = self.queueUpload(
             "bar_1.0-1_binary", queue_entry=leaf_name)

=== modified file 'lib/lp/buildmaster/interactor.py'
--- lib/lp/buildmaster/interactor.py	2013-10-26 11:02:51 +0000
+++ lib/lp/buildmaster/interactor.py	2013-11-12 07:47:57 +0000
@@ -242,7 +242,7 @@
     def getBuildBehavior(queue_item, builder, slave):
         if queue_item is None:
             return None
-        behavior = IBuildFarmJobBehavior(queue_item.specific_job)
+        behavior = IBuildFarmJobBehavior(queue_item.specific_job.build)
         behavior.setBuilder(builder, slave)
         return behavior
 
@@ -413,7 +413,7 @@
 
         new_behavior = cls.getBuildBehavior(candidate, builder, slave)
         needed_bfjb = type(removeSecurityProxy(
-            IBuildFarmJobBehavior(candidate.specific_job)))
+            IBuildFarmJobBehavior(candidate.specific_job.build)))
         if not zope_isinstance(new_behavior, needed_bfjb):
             raise AssertionError(
                 "Inappropriate IBuildFarmJobBehavior: %r is not a %r" %

=== modified file 'lib/lp/buildmaster/model/buildfarmjobbehavior.py'
--- lib/lp/buildmaster/model/buildfarmjobbehavior.py	2013-10-08 11:56:24 +0000
+++ lib/lp/buildmaster/model/buildfarmjobbehavior.py	2013-11-12 07:47:57 +0000
@@ -39,15 +39,11 @@
     All build-farm job behaviors should inherit from this.
     """
 
-    def __init__(self, buildfarmjob):
+    def __init__(self, build):
         """Store a reference to the job_type with which we were created."""
-        self.buildfarmjob = buildfarmjob
+        self.build = build
         self._builder = None
 
-    @property
-    def build(self):
-        return self.buildfarmjob.build
-
     def setBuilder(self, builder, slave):
         """The builder should be set once and not changed."""
         self._builder = builder

=== modified file 'lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py'
--- lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py	2013-10-01 00:32:26 +0000
+++ lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py	2013-11-12 07:47:57 +0000
@@ -69,9 +69,8 @@
             distroarchseries=distroarchseries, pocket=pocket, archive=archive)
 
     def test_getBuildCookie(self):
-        buildfarmjob = self.factory.makeTranslationTemplatesBuildJob()
-        build = buildfarmjob.build
-        behavior = self._makeBehavior(buildfarmjob)
+        build = self.factory.makeTranslationTemplatesBuildJob().build
+        behavior = self._makeBehavior(build)
         self.assertEqual(
             '%s-%s' % (build.job_type.name, build.id),
             behavior.getBuildCookie())
@@ -101,7 +100,7 @@
         super(TestGetUploadMethodsMixin, self).setUp()
         self.build = self.makeBuild()
         self.behavior = IBuildFarmJobBehavior(
-            self.build.buildqueue_record.specific_job)
+            self.build.buildqueue_record.specific_job.build)
 
     def test_getUploadDirLeafCookie_parseable(self):
         # getUploadDirLeaf should return a directory name

=== modified file 'lib/lp/buildmaster/tests/test_manager.py'
--- lib/lp/buildmaster/tests/test_manager.py	2013-10-26 11:02:51 +0000
+++ lib/lp/buildmaster/tests/test_manager.py	2013-11-12 07:47:57 +0000
@@ -495,7 +495,7 @@
         transaction.commit()
         login(ANONYMOUS)
         buildqueue = builder.currentjob
-        behavior = IBuildFarmJobBehavior(buildqueue.specific_job)
+        behavior = IBuildFarmJobBehavior(buildqueue.specific_job.build)
         slave.build_id = behavior.getBuildCookie()
         self.assertBuildingJob(buildqueue, builder)
 

=== modified file 'lib/lp/code/model/recipebuilder.py'
--- lib/lp/code/model/recipebuilder.py	2013-10-08 11:56:24 +0000
+++ lib/lp/code/model/recipebuilder.py	2013-11-12 07:47:57 +0000
@@ -20,7 +20,7 @@
     )
 from lp.buildmaster.model.buildfarmjobbehavior import BuildFarmJobBehaviorBase
 from lp.code.interfaces.sourcepackagerecipebuild import (
-    ISourcePackageRecipeBuildJob,
+    ISourcePackageRecipeBuild,
     )
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.config import config
@@ -33,7 +33,7 @@
 class RecipeBuildBehavior(BuildFarmJobBehaviorBase):
     """How to build a recipe on the build farm."""
 
-    adapts(ISourcePackageRecipeBuildJob)
+    adapts(ISourcePackageRecipeBuild)
     implements(IBuildFarmJobBehavior)
 
     # The list of build status values for which email notifications are
@@ -44,10 +44,6 @@
         'OK', 'PACKAGEFAIL', 'DEPFAIL', 'CHROOTFAIL']
 
     @property
-    def build(self):
-        return self.buildfarmjob.build
-
-    @property
     def display_name(self):
         ret = "%s, %s, %s" % (
             self.build.distroseries.displayname, self.build.recipe.name,

=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
--- lib/lp/code/model/tests/test_recipebuilder.py	2013-11-11 11:26:02 +0000
+++ lib/lp/code/model/tests/test_recipebuilder.py	2013-11-12 07:47:57 +0000
@@ -21,16 +21,12 @@
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 
-from lp.buildmaster.enums import (
-    BuildFarmJobType,
-    BuildStatus,
-    )
+from lp.buildmaster.enums import BuildStatus
 from lp.buildmaster.interactor import BuilderInteractor
 from lp.buildmaster.interfaces.builder import CannotBuild
 from lp.buildmaster.interfaces.buildfarmjobbehavior import (
     IBuildFarmJobBehavior,
     )
-from lp.buildmaster.model.buildqueue import BuildQueue
 from lp.buildmaster.tests.mock_slaves import (
     MockBuilder,
     OkSlave,
@@ -89,10 +85,7 @@
         spb = self.factory.makeSourcePackageRecipeBuild(
             sourcepackage=sourcepackage, archive=archive,
             recipe=recipe, requester=recipe_owner, distroseries=distroseries)
-        job = spb.makeJob()
-        job_id = removeSecurityProxy(job.job).id
-        BuildQueue(job_type=BuildFarmJobType.RECIPEBRANCHBUILD, job=job_id)
-        job = IBuildFarmJobBehavior(job)
+        job = IBuildFarmJobBehavior(spb)
         return job
 
     def test_providesInterface(self):
@@ -102,8 +95,8 @@
 
     def test_adapts_ISourcePackageRecipeBuildJob(self):
         # IBuildFarmJobBehavior adapts a ISourcePackageRecipeBuildJob
-        job = self.factory.makeSourcePackageRecipeBuild().makeJob()
-        job = IBuildFarmJobBehavior(job)
+        build = self.factory.makeSourcePackageRecipeBuild()
+        job = IBuildFarmJobBehavior(build)
         self.assertProvides(job, IBuildFarmJobBehavior)
 
     def test_display_name(self):
@@ -145,8 +138,7 @@
         # verifyBuildRequest will raise if a bad pocket is proposed.
         build = self.factory.makeSourcePackageRecipeBuild(
             pocket=PackagePublishingPocket.SECURITY)
-        job = self.factory.makeSourcePackageRecipeBuildJob(recipe_build=build)
-        job = IBuildFarmJobBehavior(job.specific_job)
+        job = IBuildFarmJobBehavior(build)
         job.setBuilder(MockBuilder("bob-de-bouwer"), OkSlave())
         e = self.assertRaises(
             AssertionError, job.verifyBuildRequest, BufferLogger())
@@ -156,8 +148,7 @@
         # A build cookie is made up of the job type and record id.
         # The uploadprocessor relies on this format.
         build = self.factory.makeSourcePackageRecipeBuild()
-        job = self.factory.makeSourcePackageRecipeBuildJob(recipe_build=build)
-        job = IBuildFarmJobBehavior(job.specific_job)
+        job = IBuildFarmJobBehavior(build)
         cookie = removeSecurityProxy(job).getBuildCookie()
         expected_cookie = "RECIPEBRANCHBUILD-%d" % build.id
         self.assertEquals(expected_cookie, cookie)

=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml	2013-09-12 05:19:43 +0000
+++ lib/lp/soyuz/configure.zcml	2013-11-12 07:47:57 +0000
@@ -797,7 +797,7 @@
 
     <!-- BinaryPackageBuildBehavior -->
     <adapter
-        for="lp.soyuz.interfaces.buildpackagejob.IBuildPackageJob"
+        for="lp.soyuz.interfaces.buildpackagejob.IBinaryPackageBuild"
         provides="lp.buildmaster.interfaces.buildfarmjobbehavior.IBuildFarmJobBehavior"
         factory="lp.soyuz.model.binarypackagebuildbehavior.BinaryPackageBuildBehavior"
         permission="zope.Public" />

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuildbehavior.py'
--- lib/lp/soyuz/tests/test_binarypackagebuildbehavior.py	2013-10-28 07:07:44 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuildbehavior.py	2013-11-12 07:47:57 +0000
@@ -98,8 +98,7 @@
             in order to trick the slave into building correctly.
         :return: A list of the calls we expect to be made.
         """
-        cookie = IBuildFarmJobBehavior(
-            build.buildqueue_record.specific_job).getBuildCookie()
+        cookie = IBuildFarmJobBehavior(build).getBuildCookie()
         ds_name = build.distro_arch_series.distroseries.name
         suite = ds_name + pocketsuffix[build.pocket]
         archives = get_sources_list_for_building(
@@ -228,8 +227,7 @@
         lf = self.factory.makeLibraryFileAlias()
         transaction.commit()
         build.distro_arch_series.addOrUpdateChroot(lf)
-        candidate = build.queueBuild()
-        behavior = IBuildFarmJobBehavior(candidate.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         behavior.setBuilder(builder, None)
         e = self.assertRaises(
             AssertionError, behavior.verifyBuildRequest, BufferLogger())
@@ -249,8 +247,7 @@
         lf = self.factory.makeLibraryFileAlias()
         transaction.commit()
         build.distro_arch_series.addOrUpdateChroot(lf)
-        candidate = build.queueBuild()
-        behavior = IBuildFarmJobBehavior(candidate.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         behavior.setBuilder(builder, None)
         e = self.assertRaises(
             AssertionError, behavior.verifyBuildRequest, BufferLogger())
@@ -268,8 +265,7 @@
         lf = self.factory.makeLibraryFileAlias()
         transaction.commit()
         build.distro_arch_series.addOrUpdateChroot(lf)
-        candidate = build.queueBuild()
-        behavior = IBuildFarmJobBehavior(candidate.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         behavior.setBuilder(builder, None)
         e = self.assertRaises(
             AssertionError, behavior.verifyBuildRequest, BufferLogger())
@@ -283,8 +279,7 @@
         builder = self.factory.makeBuilder()
         build = self.factory.makeBinaryPackageBuild(
             builder=builder, archive=archive)
-        candidate = build.queueBuild()
-        behavior = IBuildFarmJobBehavior(candidate.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         behavior.setBuilder(builder, None)
         e = self.assertRaises(
             CannotBuild, behavior.verifyBuildRequest, BufferLogger())
@@ -294,8 +289,7 @@
         # A build cookie is made up of the job type and record id.
         # The uploadprocessor relies on this format.
         build = self.factory.makeBinaryPackageBuild()
-        candidate = build.queueBuild()
-        behavior = IBuildFarmJobBehavior(candidate.specific_job)
+        behavior = IBuildFarmJobBehavior(build)
         cookie = removeSecurityProxy(behavior).getBuildCookie()
         expected_cookie = "PACKAGEBUILD-%d" % build.id
         self.assertEqual(expected_cookie, cookie)
@@ -508,7 +502,7 @@
                 'buildlog', tmp_orig_file_name)
             return d.addCallback(got_orig_log)
 
-        behavior = IBuildFarmJobBehavior(self.candidate.specific_job)
+        behavior = IBuildFarmJobBehavior(self.build)
         behavior.setBuilder(self.builder, slave)
         d = behavior.getLogFromSlave(self.build.buildqueue_record)
         return d.addCallback(got_log)

=== modified file 'lib/lp/translations/configure.zcml'
--- lib/lp/translations/configure.zcml	2013-05-09 06:04:22 +0000
+++ lib/lp/translations/configure.zcml	2013-11-12 07:47:57 +0000
@@ -654,7 +654,7 @@
 
     <adapter
         provides="lp.buildmaster.interfaces.buildfarmjobbehavior.IBuildFarmJobBehavior"
-        for="lp.translations.model.translationtemplatesbuildjob.TranslationTemplatesBuildJob"
+        for="lp.translations.model.translationtemplatesbuild.TranslationTemplatesBuild"
         factory="lp.translations.model.translationtemplatesbuildbehavior.TranslationTemplatesBuildBehavior"
         />
 

=== modified file 'lib/lp/translations/model/translationtemplatesbuildbehavior.py'
--- lib/lp/translations/model/translationtemplatesbuildbehavior.py	2013-10-08 11:56:24 +0000
+++ lib/lp/translations/model/translationtemplatesbuildbehavior.py	2013-11-12 07:47:57 +0000
@@ -50,7 +50,7 @@
     def getLogFileName(self):
         """See `IBuildFarmJob`."""
         safe_name = re.sub(
-            self.unsafe_chars, '_', self.buildfarmjob.branch.unique_name)
+            self.unsafe_chars, '_', self.build.branch.unique_name)
         return "translationtemplates_%s_%d.txt" % (safe_name, self.build.id)
 
     def dispatchBuildToSlave(self, build_queue_item, logger):
@@ -66,7 +66,7 @@
         def got_cache_file(ignored):
             args = {
                 'arch_tag': self._getDistroArchSeries().architecturetag,
-                'branch_url': self.buildfarmjob.branch.composePublicURL(),
+                'branch_url': self.build.branch.composePublicURL(),
                 }
 
             filemap = {}
@@ -88,7 +88,7 @@
         logger.info(
             "Starting templates build %s for %s." % (
             self.getBuildCookie(),
-            self.buildfarmjob.branch.bzr_identity))
+            self.build.branch.bzr_identity))
 
     def _readTarball(self, buildqueue, filemap, logger):
         """Read tarball with generated translation templates from slave."""

=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py'
--- lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py	2013-10-08 11:56:24 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py	2013-11-12 07:47:57 +0000
@@ -11,7 +11,6 @@
 from testtools.deferredruntest import AsynchronousDeferredRunTest
 from twisted.internet import defer
 from zope.component import getUtility
-from zope.security.proxy import removeSecurityProxy
 
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.buildmaster.enums import BuildStatus
@@ -20,13 +19,11 @@
 from lp.buildmaster.interfaces.buildfarmjobbehavior import (
     IBuildFarmJobBehavior,
     )
-from lp.buildmaster.model.buildqueue import BuildQueue
 from lp.buildmaster.tests.mock_slaves import (
     SlaveTestHelpers,
     WaitingSlave,
     )
 from lp.services.config import config
-from lp.services.database.interfaces import IStore
 from lp.services.librarian.interfaces import ILibraryFileAliasSet
 from lp.services.librarian.utils import copy_and_close
 from lp.testing import TestCaseWithFactory
@@ -45,13 +42,13 @@
 class FakeBuildQueue:
     """Pretend `BuildQueue`."""
 
-    def __init__(self, behavior):
+    def __init__(self, behavior, bfjo):
         """Pretend to be a BuildQueue item for the given build behavior.
 
         Copies its builder from the behavior object.
         """
         self.builder = behavior._builder
-        self.specific_job = behavior.buildfarmjob
+        self.specific_job = bfjo
         self.date_started = datetime.datetime.now(pytz.UTC)
         self.destroySelf = FakeMethod()
 
@@ -59,7 +56,8 @@
 class MakeBehaviorMixin(object):
     """Provide common test methods."""
 
-    def makeBehavior(self, branch=None, use_fake_chroot=True, **kwargs):
+    def makeBehavior(self, branch=None, use_fake_chroot=True, want_bfjo=False,
+                     **kwargs):
         """Create a TranslationTemplatesBuildBehavior.
 
         Anything that might communicate with build slaves and such
@@ -67,14 +65,17 @@
         """
         specific_job = self.factory.makeTranslationTemplatesBuildJob(
             branch=branch)
-        behavior = IBuildFarmJobBehavior(specific_job)
+        behavior = IBuildFarmJobBehavior(specific_job.build)
         slave = WaitingSlave(**kwargs)
         behavior.setBuilder(self.factory.makeBuilder(), slave)
         if use_fake_chroot:
             lf = self.factory.makeLibraryFileAlias()
             self.layer.txn.commit()
             behavior._getChroot = lambda: lf
-        return behavior
+        if want_bfjo:
+            return behavior, specific_job
+        else:
+            return behavior
 
     def makeProductSeriesWithBranchForTranslation(self):
         productseries = self.factory.makeProductSeries()
@@ -97,11 +98,6 @@
         super(TestTranslationTemplatesBuildBehavior, self).setUp()
         self.slave_helper = self.useFixture(SlaveTestHelpers())
 
-    def _getBuildQueueItem(self, behavior):
-        """Get `BuildQueue` for an `IBuildFarmJobBehavior`."""
-        job = removeSecurityProxy(behavior.buildfarmjob.job)
-        return IStore(BuildQueue).find(BuildQueue, job=job).one()
-
     def test_getLogFileName(self):
         # Each job has a unique log file name.
         b1 = self.makeBehavior()
@@ -110,9 +106,8 @@
 
     def test_dispatchBuildToSlave_no_chroot_fails(self):
         # dispatchBuildToSlave will fail if the chroot does not exist.
-        behavior = self.makeBehavior(use_fake_chroot=False)
-        buildqueue_item = self._getBuildQueueItem(behavior)
-
+        behavior, buildqueue_item = self.makeBehavior(
+            use_fake_chroot=False, want_bfjo=True)
         switch_dbuser(config.builddmaster.dbuser)
         self.assertRaises(
             CannotBuild, behavior.dispatchBuildToSlave, buildqueue_item,
@@ -122,9 +117,7 @@
         # dispatchBuildToSlave ultimately causes the slave's build
         # method to be invoked.  The slave receives the URL of the
         # branch it should build from.
-        behavior = self.makeBehavior()
-        buildqueue_item = self._getBuildQueueItem(behavior)
-
+        behavior, buildqueue_item = self.makeBehavior(want_bfjo=True)
         switch_dbuser(config.builddmaster.dbuser)
         d = behavior.dispatchBuildToSlave(buildqueue_item, logging)
 
@@ -140,7 +133,7 @@
             # The slave receives the public http URL for the branch.
             self.assertEqual(
                 branch_url,
-                behavior.buildfarmjob.branch.composePublicURL())
+                behavior.build.branch.composePublicURL())
         return d.addCallback(got_dispatch)
 
     def test_getChroot(self):
@@ -162,8 +155,8 @@
         self.assertEqual(fake_chroot_file, chroot)
 
     def test_readTarball(self):
-        behavior = self.makeBehavior()
-        buildqueue = FakeBuildQueue(behavior)
+        behavior, bfjo = self.makeBehavior(want_bfjo=True)
+        buildqueue = FakeBuildQueue(behavior, bfjo)
         path = behavior.templates_tarball_path
         # Poke the file we're expecting into the mock slave.
         behavior._slave.valid_file_hashes.append(path)
@@ -182,10 +175,10 @@
 
     def test_handleStatus_OK(self):
         # Hopefully, a build will succeed and produce a tarball.
-        behavior = self.makeBehavior(
-            filemap={'translation-templates.tar.gz': 'foo'})
+        behavior, bfjo = self.makeBehavior(
+            filemap={'translation-templates.tar.gz': 'foo'}, want_bfjo=True)
         behavior._uploadTarball = FakeMethod()
-        queue_item = FakeBuildQueue(behavior)
+        queue_item = FakeBuildQueue(behavior, bfjo)
         slave = behavior._slave
 
         d = behavior.dispatchBuildToSlave(queue_item, logging)
@@ -221,9 +214,10 @@
 
     def test_handleStatus_failed(self):
         # Builds may also fail (and produce no tarball).
-        behavior = self.makeBehavior(state='BuildStatus.FAILEDTOBUILD')
+        behavior, bfjo = self.makeBehavior(
+            state='BuildStatus.FAILEDTOBUILD', want_bfjo=True)
         behavior._uploadTarball = FakeMethod()
-        queue_item = FakeBuildQueue(behavior)
+        queue_item = FakeBuildQueue(behavior, bfjo)
         slave = behavior._slave
         d = behavior.dispatchBuildToSlave(queue_item, logging)
 
@@ -254,9 +248,9 @@
     def test_handleStatus_notarball(self):
         # Even if the build status is "OK," absence of a tarball will
         # not faze the Behavior class.
-        behavior = self.makeBehavior()
+        behavior, bfjo = self.makeBehavior(want_bfjo=True)
         behavior._uploadTarball = FakeMethod()
-        queue_item = FakeBuildQueue(behavior)
+        queue_item = FakeBuildQueue(behavior, bfjo)
         slave = behavior._slave
         d = behavior.dispatchBuildToSlave(queue_item, logging)
 
@@ -284,9 +278,10 @@
     def test_handleStatus_uploads(self):
         productseries = self.makeProductSeriesWithBranchForTranslation()
         branch = productseries.branch
-        behavior = self.makeBehavior(
-            branch=branch, filemap={'translation-templates.tar.gz': 'foo'})
-        queue_item = FakeBuildQueue(behavior)
+        behavior, bfjo = self.makeBehavior(
+            branch=branch, filemap={'translation-templates.tar.gz': 'foo'},
+            want_bfjo=True)
+        queue_item = FakeBuildQueue(behavior, bfjo)
         slave = behavior._slave
 
         d = behavior.dispatchBuildToSlave(queue_item, logging)


Follow ups