Beispiel #1
0
    def test_parent_gets_newer(self):
        # When a new source package is uploaded to the parent distroseries,
        # a job is created that updates the relevant DSD.
        dsp = self.makeDerivedDistroSeries()
        source_package_name = self.factory.makeSourcePackageName()
        self.createPublication(source_package_name, ['1.0-1derived1', '1.0-1'],
                               dsp.derived_series)
        self.createPublication(source_package_name, ['1.0-1'],
                               dsp.parent_series)

        # Creating the SPPHs has created jobs for us, so grab them off
        # the queue.
        jobs = find_waiting_jobs(dsp.derived_series, source_package_name,
                                 dsp.parent_series)
        self.runJob(jobs[0])
        ds_diff = find_dsd_for(dsp, source_package_name)
        self.assertEqual(1, ds_diff.count())
        self.assertEqual('1.0-1', ds_diff[0].parent_source_version)
        self.assertEqual('1.0-1derived1', ds_diff[0].source_version)
        self.assertEqual('1.0-1', ds_diff[0].base_version)
        # Now create a 1.0-2 upload to the parent.
        self.createPublication(source_package_name, ['1.0-2', '1.0-1'],
                               dsp.parent_series)
        jobs = find_waiting_jobs(dsp.derived_series, source_package_name,
                                 dsp.parent_series)
        self.runJob(jobs[0])
        # And the DSD we have a hold of will have updated.
        self.assertEqual('1.0-2', ds_diff[0].parent_source_version)
        self.assertEqual('1.0-1derived1', ds_diff[0].source_version)
        self.assertEqual('1.0-1', ds_diff[0].base_version)
Beispiel #2
0
 def test_update_deletes_diffs(self):
     # When a DSD is updated, the diffs are invalidated.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(source_package_name, ['1.0-1derived1', '1.0-1'],
                            derived_series)
     self.createPublication(source_package_name, ['1.0-2', '1.0-1'],
                            dsp.parent_series)
     spr = self.factory.makeSourcePackageRelease(
         sourcepackagename=source_package_name, version='1.0-1')
     self.factory.makeSourcePackagePublishingHistory(
         sourcepackagerelease=spr,
         archive=dsp.parent_series.main_archive,
         distroseries=dsp.parent_series,
         status=PackagePublishingStatus.SUPERSEDED)
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     ds_diff[0].requestPackageDiffs(self.factory.makePerson())
     self.assertIsNot(None, ds_diff[0].package_diff)
     self.assertIsNot(None, ds_diff[0].parent_package_diff)
     self.createPublication(source_package_name,
                            ['1.0-3', '1.0-2', '1.0-1'], dsp.parent_series)
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     # Since the diff showing the changes from 1.0-1 to 1.0-1derived1 is
     # still valid, it isn't reset, but the parent diff is.
     self.assertIsNot(None, ds_diff[0].package_diff)
     self.assertIs(None, ds_diff[0].parent_package_diff)
Beispiel #3
0
    def test_child_gets_newer(self):
        # When a new source is uploaded to the child distroseries, the DSD is
        # updated and auto-blacklisted.
        dsp = self.makeDerivedDistroSeries()
        source_package_name = self.factory.makeSourcePackageName()
        self.createPublication(source_package_name, ['1.0-1'],
                               dsp.derived_series)
        self.createPublication(source_package_name, ['1.0-1'],
                               dsp.parent_series)
        jobs = find_waiting_jobs(dsp.derived_series, source_package_name,
                                 dsp.parent_series)
        self.runJob(jobs[0])
        ds_diff = find_dsd_for(dsp, source_package_name)
        self.assertEqual(DistroSeriesDifferenceStatus.RESOLVED,
                         ds_diff[0].status)
        self.createPublication(source_package_name, ['2.0-0derived1', '1.0-1'],
                               dsp.derived_series)
        jobs = find_waiting_jobs(dsp.derived_series, source_package_name,
                                 dsp.parent_series)
        self.runJob(jobs[0])
        self.assertEqual(DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
                         ds_diff[0].status)
        self.assertEqual('1.0-1', ds_diff[0].base_version)

        # An additional upload should not change the blacklisted status.
        self.createPublication(source_package_name, ['2.0-0derived2', '1.0-1'],
                               dsp.derived_series)
        jobs = find_waiting_jobs(dsp.derived_series, source_package_name,
                                 dsp.parent_series)
        self.runJob(jobs[0])
        self.assertEqual(DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
                         ds_diff[0].status)
    def test_parent_gets_newer(self):
        # When a new source package is uploaded to the parent distroseries,
        # a job is created that updates the relevant DSD.
        dsp = self.makeDerivedDistroSeries()
        source_package_name = self.factory.makeSourcePackageName()
        self.createPublication(
            source_package_name, ['1.0-1derived1', '1.0-1'],
            dsp.derived_series)
        self.createPublication(
            source_package_name, ['1.0-1'], dsp.parent_series)

        # Creating the SPPHs has created jobs for us, so grab them off
        # the queue.
        jobs = find_waiting_jobs(
            dsp.derived_series, source_package_name, dsp.parent_series)
        self.runJob(jobs[0])
        ds_diff = find_dsd_for(dsp, source_package_name)
        self.assertEqual(1, ds_diff.count())
        self.assertEqual('1.0-1', ds_diff[0].parent_source_version)
        self.assertEqual('1.0-1derived1', ds_diff[0].source_version)
        self.assertEqual('1.0-1', ds_diff[0].base_version)
        # Now create a 1.0-2 upload to the parent.
        self.createPublication(
            source_package_name, ['1.0-2', '1.0-1'],
            dsp.parent_series)
        jobs = find_waiting_jobs(
            dsp.derived_series, source_package_name, dsp.parent_series)
        self.runJob(jobs[0])
        # And the DSD we have a hold of will have updated.
        self.assertEqual('1.0-2', ds_diff[0].parent_source_version)
        self.assertEqual('1.0-1derived1', ds_diff[0].source_version)
        self.assertEqual('1.0-1', ds_diff[0].base_version)
 def test_update_deletes_diffs(self):
     # When a DSD is updated, the diffs are invalidated.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(
         source_package_name, ['1.0-1derived1', '1.0-1'], derived_series)
     self.createPublication(
         source_package_name, ['1.0-2', '1.0-1'], dsp.parent_series)
     spr = self.factory.makeSourcePackageRelease(
         sourcepackagename=source_package_name, version='1.0-1')
     self.factory.makeSourcePackagePublishingHistory(
         sourcepackagerelease=spr,
         archive=dsp.parent_series.main_archive,
         distroseries=dsp.parent_series,
         status=PackagePublishingStatus.SUPERSEDED)
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     ds_diff[0].requestPackageDiffs(self.factory.makePerson())
     self.assertIsNot(None, ds_diff[0].package_diff)
     self.assertIsNot(None, ds_diff[0].parent_package_diff)
     self.createPublication(
         source_package_name, ['1.0-3', '1.0-2', '1.0-1'],
         dsp.parent_series)
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     # Since the diff showing the changes from 1.0-1 to 1.0-1derived1 is
     # still valid, it isn't reset, but the parent diff is.
     self.assertIsNot(None, ds_diff[0].package_diff)
     self.assertIs(None, ds_diff[0].parent_package_diff)
 def test_find_waiting_jobs_considers_only_waiting_jobs(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     job = create_job(dsp.derived_series, package, dsp.parent_series)
     job.start()
     self.assertContentEqual(
         [],
         find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
     job.complete()
     self.assertContentEqual(
         [],
         find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
Beispiel #7
0
 def test_find_waiting_jobs_considers_only_waiting_jobs(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     job = create_job(dsp.derived_series, package, dsp.parent_series)
     job.start()
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, package,
                                               dsp.parent_series))
     job.complete()
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, package,
                                               dsp.parent_series))
Beispiel #8
0
    def test_createForSPPHs_accepts_SPPHs_for_multiple_distroseries(self):
        derived_distro = self.factory.makeDistribution()
        spn = self.factory.makeSourcePackageName()
        series = [
            self.factory.makeDistroSeries(derived_distro)
            for counter in xrange(2)
        ]
        dsps = [
            self.factory.makeDistroSeriesParent(derived_series=distroseries)
            for distroseries in series
        ]

        for distroseries in series:
            self.factory.makeSourcePackagePublishingHistory(
                distroseries,
                pocket=PackagePublishingPocket.RELEASE,
                sourcepackagerelease=self.factory.makeSourcePackageRelease(
                    sourcepackagename=spn))

        job_counts = dict((
            dsp.derived_series,
            len(find_waiting_jobs(dsp.derived_series, spn, dsp.parent_series)))
                          for dsp in dsps)
        self.assertEqual(dict((distroseries, 1) for distroseries in series),
                         job_counts)
 def find_waiting_jobs_finds_waiting_jobs(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     job = create_job(dsp.derived_series, package, dsp.parent_series)
     self.assertContentEqual(
         [job],
         find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
 def find_waiting_jobs_ignores_other_parent_series(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     create_job(dsp.derived_series, package, dsp.parent_series)
     other_series = self.factory.makeDistroSeries()
     self.assertContentEqual(
         [], find_waiting_jobs(dsp.derived_series, package, other_series))
Beispiel #11
0
 def find_waiting_jobs_finds_waiting_jobs(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     job = create_job(dsp.derived_series, package, dsp.parent_series)
     self.assertContentEqual([job],
                             find_waiting_jobs(dsp.derived_series, package,
                                               dsp.parent_series))
Beispiel #12
0
 def find_waiting_jobs_ignores_other_parent_series(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     create_job(dsp.derived_series, package, dsp.parent_series)
     other_series = self.factory.makeDistroSeries()
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, package,
                                               other_series))
 def test_createForPackagePublication_ignores_backports_and_proposed(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     self.getJobSource().createForPackagePublication(
         dsp.derived_series, package, PackagePublishingPocket.BACKPORTS)
     self.getJobSource().createForPackagePublication(
         dsp.derived_series, package, PackagePublishingPocket.PROPOSED)
     self.assertContentEqual(
         [],
         find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
 def test_createForSPPHs_creates_no_jobs_for_unrelated_series(self):
     dsp = self.factory.makeDistroSeriesParent()
     other_series = self.factory.makeDistroSeries(
         distribution=dsp.derived_series.distribution)
     spph = self.factory.makeSourcePackagePublishingHistory(
         dsp.parent_series, pocket=PackagePublishingPocket.RELEASE)
     spn = spph.sourcepackagerelease.sourcepackagename
     self.getJobSource().createForSPPHs([spph])
     self.assertContentEqual(
         [], find_waiting_jobs(dsp.derived_series, spn, other_series))
Beispiel #15
0
 def test_createForPackagePublication_ignores_backports_and_proposed(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     self.getJobSource().createForPackagePublication(
         dsp.derived_series, package, PackagePublishingPocket.BACKPORTS)
     self.getJobSource().createForPackagePublication(
         dsp.derived_series, package, PackagePublishingPocket.PROPOSED)
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, package,
                                               dsp.parent_series))
    def test_createForSPPHs_creates_job_for_parent_series(self):
        dsp = self.factory.makeDistroSeriesParent()
        spph = self.factory.makeSourcePackagePublishingHistory(
            dsp.derived_series, pocket=PackagePublishingPocket.RELEASE)
        spn = spph.sourcepackagerelease.sourcepackagename

        self.getJobSource().createForSPPHs([spph])

        self.assertEqual(
            1, len(find_waiting_jobs(
                dsp.derived_series, spn, dsp.parent_series)))
 def test_no_job_for_PPA(self):
     # If a source package is uploaded to a PPA, a job is not created.
     dsp = self.makeDerivedDistroSeries()
     source_package_name = self.factory.makeSourcePackageName()
     ppa = self.factory.makeArchive()
     self.createPublication(
         source_package_name, ['1.0-1'], dsp.derived_series, ppa)
     self.assertContentEqual(
         [],
         find_waiting_jobs(
             dsp.derived_series, source_package_name, dsp.parent_series))
Beispiel #18
0
 def test_createForSPPHs_creates_no_jobs_for_unrelated_series(self):
     dsp = self.factory.makeDistroSeriesParent()
     other_series = self.factory.makeDistroSeries(
         distribution=dsp.derived_series.distribution)
     spph = self.factory.makeSourcePackagePublishingHistory(
         dsp.parent_series, pocket=PackagePublishingPocket.RELEASE)
     spn = spph.sourcepackagerelease.sourcepackagename
     self.getJobSource().createForSPPHs([spph])
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, spn,
                                               other_series))
Beispiel #19
0
 def test_no_job_for_PPA(self):
     # If a source package is uploaded to a PPA, a job is not created.
     dsp = self.makeDerivedDistroSeries()
     source_package_name = self.factory.makeSourcePackageName()
     ppa = self.factory.makeArchive()
     self.createPublication(source_package_name, ['1.0-1'],
                            dsp.derived_series, ppa)
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series,
                                               source_package_name,
                                               dsp.parent_series))
Beispiel #20
0
    def test_createForSPPHs_creates_job_for_parent_series(self):
        dsp = self.factory.makeDistroSeriesParent()
        spph = self.factory.makeSourcePackagePublishingHistory(
            dsp.derived_series, pocket=PackagePublishingPocket.RELEASE)
        spn = spph.sourcepackagerelease.sourcepackagename

        self.getJobSource().createForSPPHs([spph])

        self.assertEqual(
            1,
            len(find_waiting_jobs(dsp.derived_series, spn, dsp.parent_series)))
 def test_createForSPPHs_creates_no_jobs_for_ppas(self):
     dsp = self.factory.makeDistroSeriesParent()
     series = dsp.parent_series
     spph = self.factory.makeSourcePackagePublishingHistory(
         series, pocket=PackagePublishingPocket.RELEASE,
         archive=self.factory.makeArchive(
             distribution=series.distribution, purpose=ArchivePurpose.PPA))
     spn = spph.sourcepackagerelease.sourcepackagename
     self.getJobSource().createForSPPHs([spph])
     self.assertContentEqual(
         [], find_waiting_jobs(dsp.derived_series, spn, dsp.parent_series))
Beispiel #22
0
 def test_deleted_in_parent(self):
     # If a source package is deleted in the parent, a job is created, and
     # the DSD is updated correctly.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(source_package_name, ['1.0-1'], derived_series)
     spph = self.createPublication(source_package_name, ['1.0-1'],
                                   dsp.parent_series)
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     self.assertEqual(DistroSeriesDifferenceStatus.RESOLVED,
                      ds_diff[0].status)
     spph.requestDeletion(self.factory.makePerson())
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     self.assertEqual(DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES,
                      ds_diff[0].difference_type)
 def test_no_job_for_PPA_with_deleted_source(self):
     # If a source package is deleted from a PPA, no job is created.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     ppa = self.factory.makeArchive()
     spph = self.createPublication(
         source_package_name, ['1.0-1'], derived_series, ppa)
     spph.requestDeletion(ppa.owner)
     self.assertContentEqual(
         [],
         find_waiting_jobs(
             derived_series, source_package_name, dsp.parent_series))
Beispiel #24
0
 def test_no_job_for_PPA_with_deleted_source(self):
     # If a source package is deleted from a PPA, no job is created.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     ppa = self.factory.makeArchive()
     spph = self.createPublication(source_package_name, ['1.0-1'],
                                   derived_series, ppa)
     spph.requestDeletion(ppa.owner)
     self.assertContentEqual([],
                             find_waiting_jobs(derived_series,
                                               source_package_name,
                                               dsp.parent_series))
Beispiel #25
0
 def test_child_is_synced(self):
     # If the source package gets 'synced' to the child from the parent,
     # the job correctly updates the DSD.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(source_package_name, ['1.0-1derived1', '1.0-1'],
                            derived_series)
     self.createPublication(source_package_name, ['1.0-2', '1.0-1'],
                            dsp.parent_series)
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     self.assertEqual('1.0-1', ds_diff[0].base_version)
     self.createPublication(source_package_name, ['1.0-2', '1.0-1'],
                            derived_series)
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     self.assertEqual(DistroSeriesDifferenceStatus.RESOLVED,
                      ds_diff[0].status)
Beispiel #26
0
 def test_createForSPPHs_creates_no_jobs_for_ppas(self):
     dsp = self.factory.makeDistroSeriesParent()
     series = dsp.parent_series
     spph = self.factory.makeSourcePackagePublishingHistory(
         series,
         pocket=PackagePublishingPocket.RELEASE,
         archive=self.factory.makeArchive(distribution=series.distribution,
                                          purpose=ArchivePurpose.PPA))
     spn = spph.sourcepackagerelease.sourcepackagename
     self.getJobSource().createForSPPHs([spph])
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, spn,
                                               dsp.parent_series))
 def test_child_is_synced(self):
     # If the source package gets 'synced' to the child from the parent,
     # the job correctly updates the DSD.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(
         source_package_name, ['1.0-1derived1', '1.0-1'], derived_series)
     self.createPublication(
         source_package_name, ['1.0-2', '1.0-1'], dsp.parent_series)
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     self.assertEqual('1.0-1', ds_diff[0].base_version)
     self.createPublication(
         source_package_name, ['1.0-2', '1.0-1'], derived_series)
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     self.assertEqual(
         DistroSeriesDifferenceStatus.RESOLVED, ds_diff[0].status)
 def test_deleted_in_child(self):
     # If a source package is deleted in the child, a job is created, and
     # the DSD is updated correctly.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     spph = self.createPublication(
         source_package_name, ['1.0-1'], derived_series)
     self.createPublication(
         source_package_name, ['1.0-1'], dsp.parent_series)
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     self.assertEqual(
         DistroSeriesDifferenceStatus.RESOLVED, ds_diff[0].status)
     spph.requestDeletion(self.factory.makePerson())
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     self.assertEqual(
         DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES,
         ds_diff[0].difference_type)
Beispiel #29
0
 def test_only_in_child(self):
     # If a source package only exists in the child distroseries, the DSD
     # is created with the right type.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(source_package_name, ['1.0-0derived1'],
                            derived_series)
     jobs = find_waiting_jobs(derived_series, source_package_name,
                              dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     self.assertEqual(DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES,
                      ds_diff[0].difference_type)
    def test_child_gets_newer(self):
        # When a new source is uploaded to the child distroseries, the DSD is
        # updated and auto-blacklisted.
        dsp = self.makeDerivedDistroSeries()
        source_package_name = self.factory.makeSourcePackageName()
        self.createPublication(
            source_package_name, ['1.0-1'], dsp.derived_series)
        self.createPublication(
            source_package_name, ['1.0-1'], dsp.parent_series)
        jobs = find_waiting_jobs(
            dsp.derived_series, source_package_name, dsp.parent_series)
        self.runJob(jobs[0])
        ds_diff = find_dsd_for(dsp, source_package_name)
        self.assertEqual(
            DistroSeriesDifferenceStatus.RESOLVED, ds_diff[0].status)
        self.createPublication(
            source_package_name, ['2.0-0derived1', '1.0-1'],
            dsp.derived_series)
        jobs = find_waiting_jobs(
            dsp.derived_series, source_package_name, dsp.parent_series)
        self.runJob(jobs[0])
        self.assertEqual(
            DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
            ds_diff[0].status)
        self.assertEqual('1.0-1', ds_diff[0].base_version)

        # An additional upload should not change the blacklisted status.
        self.createPublication(
            source_package_name, ['2.0-0derived2', '1.0-1'],
            dsp.derived_series)
        jobs = find_waiting_jobs(
            dsp.derived_series, source_package_name, dsp.parent_series)
        self.runJob(jobs[0])
        self.assertEqual(
            DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
            ds_diff[0].status)
 def test_only_in_parent(self):
     # If a source package only exists in the parent distroseries, the DSD
     # is created with the right type.
     dsp = self.makeDerivedDistroSeries()
     derived_series = dsp.derived_series
     source_package_name = self.factory.makeSourcePackageName()
     self.createPublication(
         source_package_name, ['1.0-1'], dsp.parent_series)
     jobs = find_waiting_jobs(
         derived_series, source_package_name, dsp.parent_series)
     self.runJob(jobs[0])
     ds_diff = self.findDSD(derived_series, source_package_name)
     self.assertEqual(
         DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES,
         ds_diff[0].difference_type)
 def test_createForSPPHs_ignores_backports_and_proposed(self):
     dsp = self.factory.makeDistroSeriesParent()
     spr = self.factory.makeSourcePackageRelease()
     spn = spr.sourcepackagename
     ignored_pockets = [
         PackagePublishingPocket.BACKPORTS,
         PackagePublishingPocket.PROPOSED,
         ]
     spphs = [
         self.factory.makeSourcePackagePublishingHistory(
             distroseries=dsp.parent_series, sourcepackagerelease=spr,
             pocket=pocket)
         for pocket in ignored_pockets]
     self.getJobSource().createForSPPHs(spphs)
     self.assertContentEqual(
         [], find_waiting_jobs(dsp.derived_series, spn, dsp.parent_series))
Beispiel #33
0
    def test_createForPackagePublication_creates_job_for_derived_series(self):
        # A call to createForPackagePublication for the derived_series
        # creates a job for the derived series.
        dsp = self.factory.makeDistroSeriesParent()
        parent_dsp = self.factory.makeDistroSeriesParent(
            derived_series=dsp.parent_series)
        package = self.factory.makeSourcePackageName()
        self.getJobSource().createForPackagePublication(
            parent_dsp.derived_series, package,
            PackagePublishingPocket.RELEASE)
        jobs = find_waiting_jobs(dsp.derived_series, package,
                                 dsp.parent_series)

        self.assertEquals(len(jobs), 1)
        self.assertJobsSeriesAndMetadata(jobs[0], dsp.derived_series,
                                         [package.id, dsp.parent_series.id])
    def test_createForSPPHs_behaves_sensibly_if_job_already_exists(self):
        # If a job already existed, createForSPPHs may create a
        # redundant one but it certainly won't do anything weird like
        # delete what was there or create too many.
        dsp = self.factory.makeDistroSeriesParent()
        spph = self.factory.makeSourcePackagePublishingHistory(
            dsp.parent_series, pocket=PackagePublishingPocket.RELEASE)
        spn = spph.sourcepackagerelease.sourcepackagename

        create_jobs = range(1, 3)
        for counter in create_jobs:
            self.getJobSource().createForSPPHs([spph])

        job_count = len(find_waiting_jobs(
            dsp.derived_series, spn, dsp.parent_series))
        self.assertIn(job_count, create_jobs)
    def test_createForPackagePublication_creates_job_for_derived_series(self):
        # A call to createForPackagePublication for the derived_series
        # creates a job for the derived series.
        dsp = self.factory.makeDistroSeriesParent()
        parent_dsp = self.factory.makeDistroSeriesParent(
            derived_series=dsp.parent_series)
        package = self.factory.makeSourcePackageName()
        self.getJobSource().createForPackagePublication(
            parent_dsp.derived_series, package,
            PackagePublishingPocket.RELEASE)
        jobs = find_waiting_jobs(
            dsp.derived_series, package, dsp.parent_series)

        self.assertEquals(len(jobs), 1)
        self.assertJobsSeriesAndMetadata(
            jobs[0], dsp.derived_series, [package.id, dsp.parent_series.id])
Beispiel #36
0
    def test_createForSPPHs_behaves_sensibly_if_job_already_exists(self):
        # If a job already existed, createForSPPHs may create a
        # redundant one but it certainly won't do anything weird like
        # delete what was there or create too many.
        dsp = self.factory.makeDistroSeriesParent()
        spph = self.factory.makeSourcePackagePublishingHistory(
            dsp.parent_series, pocket=PackagePublishingPocket.RELEASE)
        spn = spph.sourcepackagerelease.sourcepackagename

        create_jobs = range(1, 3)
        for counter in create_jobs:
            self.getJobSource().createForSPPHs([spph])

        job_count = len(
            find_waiting_jobs(dsp.derived_series, spn, dsp.parent_series))
        self.assertIn(job_count, create_jobs)
Beispiel #37
0
 def test_createForSPPHs_ignores_backports_and_proposed(self):
     dsp = self.factory.makeDistroSeriesParent()
     spr = self.factory.makeSourcePackageRelease()
     spn = spr.sourcepackagename
     ignored_pockets = [
         PackagePublishingPocket.BACKPORTS,
         PackagePublishingPocket.PROPOSED,
     ]
     spphs = [
         self.factory.makeSourcePackagePublishingHistory(
             distroseries=dsp.parent_series,
             sourcepackagerelease=spr,
             pocket=pocket) for pocket in ignored_pockets
     ]
     self.getJobSource().createForSPPHs(spphs)
     self.assertContentEqual([],
                             find_waiting_jobs(dsp.derived_series, spn,
                                               dsp.parent_series))
Beispiel #38
0
 def test_cronscript(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     self.getJobSource().createForPackagePublication(
         dsp.derived_series, package, PackagePublishingPocket.RELEASE)
     # Make changes visible to the process we'll be spawning.
     transaction.commit()
     return_code, stdout, stderr = run_script(
         'cronscripts/process-job-source.py',
         ['-v', 'IDistroSeriesDifferenceJobSource'])
     # The cronscript ran how we expected it to.
     self.assertEqual(return_code, 0)
     self.assertIn('INFO    Ran 1 DistroSeriesDifferenceJob jobs.', stderr)
     # And it did what we expected.
     jobs = find_waiting_jobs(dsp.derived_series, package,
                              dsp.parent_series)
     self.assertContentEqual([], jobs)
     self.assertEqual(1, find_dsd_for(dsp, package).count())
 def test_cronscript(self):
     dsp = self.factory.makeDistroSeriesParent()
     package = self.factory.makeSourcePackageName()
     self.getJobSource().createForPackagePublication(
         dsp.derived_series, package, PackagePublishingPocket.RELEASE)
     # Make changes visible to the process we'll be spawning.
     transaction.commit()
     return_code, stdout, stderr = run_script(
         'cronscripts/process-job-source.py',
         ['-v', 'IDistroSeriesDifferenceJobSource'])
     # The cronscript ran how we expected it to.
     self.assertEqual(return_code, 0)
     self.assertIn(
         'INFO    Ran 1 DistroSeriesDifferenceJob jobs.', stderr)
     # And it did what we expected.
     jobs = find_waiting_jobs(
         dsp.derived_series, package, dsp.parent_series)
     self.assertContentEqual([], jobs)
     self.assertEqual(1, find_dsd_for(dsp, package).count())
    def test_createForSPPHs_accepts_SPPHs_for_multiple_distroseries(self):
        derived_distro = self.factory.makeDistribution()
        spn = self.factory.makeSourcePackageName()
        series = [
            self.factory.makeDistroSeries(derived_distro)
            for counter in xrange(2)]
        dsps = [
            self.factory.makeDistroSeriesParent(derived_series=distroseries)
            for distroseries in series]

        for distroseries in series:
            self.factory.makeSourcePackagePublishingHistory(
                distroseries, pocket=PackagePublishingPocket.RELEASE,
                sourcepackagerelease=self.factory.makeSourcePackageRelease(
                    sourcepackagename=spn))

        job_counts = dict(
            (dsp.derived_series, len(find_waiting_jobs(
                dsp.derived_series, spn, dsp.parent_series)))
            for dsp in dsps)
        self.assertEqual(
            dict((distroseries, 1) for distroseries in series),
            job_counts)