def test_non_virtual_ppa_dispatch(self):
     # When the BinaryPackageBuildBehaviour dispatches PPA builds to
     # non-virtual builders, it stores the chroot on the server and
     # requests a binary package build, lying to say that the archive
     # purpose is "PRIMARY" because this ensures that the package mangling
     # tools will run over the built packages.
     archive = self.factory.makeArchive(virtualized=False)
     slave = OkSlave()
     builder = self.factory.makeBuilder(virtualized=False)
     builder.setCleanStatus(BuilderCleanStatus.CLEAN)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(builder=builder,
                                                 archive=archive)
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     yield interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehaviour(bq, builder, slave), BufferLogger())
     yield self.assertExpectedInteraction(slave.call_log, builder, build,
                                          lf, archive,
                                          ArchivePurpose.PRIMARY,
                                          'universe')
 def test_private_source_dispatch(self):
     archive = self.factory.makeArchive(private=True)
     slave = OkSlave()
     builder = self.factory.makeBuilder()
     builder.setCleanStatus(BuilderCleanStatus.CLEAN)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(builder=builder,
                                                 archive=archive)
     sprf = build.source_package_release.addFile(
         self.factory.makeLibraryFileAlias(db_only=True),
         filetype=SourcePackageFileType.ORIG_TARBALL)
     sprf_url = (
         'http://private-ppa.launchpad.dev/%s/%s/ubuntu/pool/%s/%s' %
         (archive.owner.name, archive.name,
          poolify(build.source_package_release.sourcepackagename.name,
                  'main'), sprf.libraryfile.filename))
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     yield interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehaviour(bq, builder, slave), BufferLogger())
     yield self.assertExpectedInteraction(
         slave.call_log,
         builder,
         build,
         lf,
         archive,
         ArchivePurpose.PPA,
         extra_uploads=[(sprf_url, 'buildd', 'sekrit')],
         filemap_names=[sprf.libraryfile.filename])
 def test_non_virtual_ppa_dispatch_with_primary_ancestry(self):
     # If there is a primary component override, it is honoured for
     # non-virtual PPA builds too.
     archive = self.factory.makeArchive(virtualized=False)
     slave = OkSlave()
     builder = self.factory.makeBuilder(virtualized=False)
     builder.setCleanStatus(BuilderCleanStatus.CLEAN)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(builder=builder,
                                                 archive=archive)
     self.factory.makeSourcePackagePublishingHistory(
         distroseries=build.distro_series,
         archive=archive.distribution.main_archive,
         sourcepackagename=build.source_package_release.sourcepackagename,
         component='main')
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     yield interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehaviour(bq, builder, slave), BufferLogger())
     yield self.assertExpectedInteraction(slave.call_log, builder, build,
                                          lf, archive,
                                          ArchivePurpose.PRIMARY, 'main')
    def test_virtual_ppa_dispatch(self):
        # Make sure the builder slave gets reset before a build is
        # dispatched to it.
        archive = self.factory.makeArchive(virtualized=True)
        slave = OkSlave()
        builder = self.factory.makeBuilder(
            virtualized=True, vm_host="foohost")
        vitals = extract_vitals_from_db(builder)
        build = self.factory.makeBinaryPackageBuild(
            builder=builder, archive=archive)
        lf = self.factory.makeLibraryFileAlias()
        transaction.commit()
        build.distro_arch_series.addOrUpdateChroot(lf)
        bq = build.queueBuild()
        bq.markAsBuilding(builder)
        interactor = BuilderInteractor()
        d = interactor._startBuild(
            bq, vitals, builder, slave,
            interactor.getBuildBehavior(bq, builder, slave), BufferLogger())

        def check_build(ignored):
            # We expect the first call to the slave to be a resume call,
            # followed by the rest of the usual calls we expect.
            expected_resume_call = slave.call_log.pop(0)
            self.assertEqual('resume', expected_resume_call)
            self.assertExpectedInteraction(
                ignored, slave.call_log, builder, build, lf, archive,
                ArchivePurpose.PPA)
        return d.addCallback(check_build)
 def test_non_virtual_ppa_dispatch(self):
     # When the BinaryPackageBuildBehavior dispatches PPA builds to
     # non-virtual builders, it stores the chroot on the server and
     # requests a binary package build, lying to say that the archive
     # purpose is "PRIMARY" because this ensures that the package mangling
     # tools will run over the built packages.
     archive = self.factory.makeArchive(virtualized=False)
     slave = OkSlave()
     builder = self.factory.makeBuilder(virtualized=False)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(
         builder=builder, archive=archive)
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     d = interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehavior(bq, builder, slave), BufferLogger())
     d.addCallback(
         self.assertExpectedInteraction, slave.call_log, builder, build,
         lf, archive, ArchivePurpose.PRIMARY, 'universe')
     return d
Exemplo n.º 6
0
    def test_virtual_ppa_dispatch(self):
        # Make sure the builder slave gets reset before a build is
        # dispatched to it.
        archive = self.factory.makeArchive(virtualized=True)
        slave = OkSlave()
        builder = self.factory.makeBuilder(virtualized=True, vm_host="foohost")
        vitals = extract_vitals_from_db(builder)
        build = self.factory.makeBinaryPackageBuild(builder=builder,
                                                    archive=archive)
        lf = self.factory.makeLibraryFileAlias()
        transaction.commit()
        build.distro_arch_series.addOrUpdateChroot(lf)
        bq = build.queueBuild()
        bq.markAsBuilding(builder)
        interactor = BuilderInteractor()
        d = interactor._startBuild(
            bq, vitals, builder, slave,
            interactor.getBuildBehavior(bq, builder, slave), BufferLogger())

        def check_build(ignored):
            # We expect the first call to the slave to be a resume call,
            # followed by the rest of the usual calls we expect.
            expected_resume_call = slave.call_log.pop(0)
            self.assertEqual('resume', expected_resume_call)
            self.assertExpectedInteraction(ignored, slave.call_log, builder,
                                           build, lf, archive,
                                           ArchivePurpose.PPA)

        return d.addCallback(check_build)
 def test_virtual_ppa_dispatch(self):
     archive = self.factory.makeArchive(virtualized=True)
     slave = OkSlave()
     builder = self.factory.makeBuilder(virtualized=True, vm_host="foohost")
     builder.setCleanStatus(BuilderCleanStatus.CLEAN)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(builder=builder,
                                                 archive=archive)
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     yield interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehaviour(bq, builder, slave), BufferLogger())
     yield self.assertExpectedInteraction(slave.call_log, builder, build,
                                          lf, archive, ArchivePurpose.PPA)
Exemplo n.º 8
0
 def test_partner_dispatch_no_publishing_history(self):
     archive = self.factory.makeArchive(virtualized=False,
                                        purpose=ArchivePurpose.PARTNER)
     slave = OkSlave()
     builder = self.factory.makeBuilder(virtualized=False)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(builder=builder,
                                                 archive=archive)
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     d = interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehavior(bq, builder, slave), BufferLogger())
     d.addCallback(self.assertExpectedInteraction, slave.call_log, builder,
                   build, lf, archive, ArchivePurpose.PARTNER)
     return d
 def test_partner_dispatch_no_publishing_history(self):
     archive = self.factory.makeArchive(
         virtualized=False, purpose=ArchivePurpose.PARTNER)
     slave = OkSlave()
     builder = self.factory.makeBuilder(virtualized=False)
     vitals = extract_vitals_from_db(builder)
     build = self.factory.makeBinaryPackageBuild(
         builder=builder, archive=archive)
     lf = self.factory.makeLibraryFileAlias()
     transaction.commit()
     build.distro_arch_series.addOrUpdateChroot(lf)
     bq = build.queueBuild()
     bq.markAsBuilding(builder)
     interactor = BuilderInteractor()
     d = interactor._startBuild(
         bq, vitals, builder, slave,
         interactor.getBuildBehavior(bq, builder, slave), BufferLogger())
     d.addCallback(
         self.assertExpectedInteraction, slave.call_log, builder, build,
         lf, archive, ArchivePurpose.PARTNER)
     return d