← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/copy-set-phase-2 into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/copy-set-phase-2 into lp:launchpad.

Commit message:
Remember to pass phased_update_percentage through from PCJ to do_copy.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/copy-set-phase-2/+merge/175029

I missed a piece in https://code.launchpad.net/~cjwatson/launchpad/copy-set-phase/+merge/170775 and forgot to pass the phased_update_percentage setting down from the PCJ model to the copier script.  This branch fixes that so that QA of the prior branch can pass.
-- 
https://code.launchpad.net/~cjwatson/launchpad/copy-set-phase-2/+merge/175029
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/copy-set-phase-2 into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
--- lib/lp/soyuz/model/packagecopyjob.py	2013-07-16 08:10:32 +0000
+++ lib/lp/soyuz/model/packagecopyjob.py	2013-07-16 14:20:44 +0000
@@ -658,7 +658,8 @@
             person=self.requester, overrides=[override],
             send_email=send_email, announce_from_person=self.requester,
             sponsored=self.sponsored, packageupload=pu,
-            unembargo=self.unembargo)
+            unembargo=self.unembargo,
+            phased_update_percentage=self.phased_update_percentage)
 
         # Add a PackageDiff for this new upload if it has ancestry.
         if copied_publications and not ancestry.is_empty():

=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py	2013-07-16 08:10:32 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py	2013-07-16 14:20:44 +0000
@@ -1411,6 +1411,45 @@
             [custom_file],
             [custom.libraryfilealias for custom in upload.customfiles])
 
+    def test_copy_phased_update_percentage(self):
+        # The copier applies any requested phased_update_percentage.
+        self.distroseries.status = SeriesStatus.CURRENT
+        archive = self.factory.makeArchive(
+            self.distroseries.distribution, purpose=ArchivePurpose.PRIMARY)
+
+        # Publish a test package.
+        spph = self.publisher.getPubSource(
+            distroseries=self.distroseries,
+            status=PackagePublishingStatus.PUBLISHED,
+            pocket=PackagePublishingPocket.PROPOSED)
+        self.publisher.getPubBinaries(
+            binaryname="copyme", pub_source=spph,
+            distroseries=self.distroseries,
+            status=PackagePublishingStatus.PUBLISHED,
+            pocket=PackagePublishingPocket.PROPOSED)
+
+        # Create and run the job.
+        requester = self.factory.makePerson()
+        with person_logged_in(archive.owner):
+            archive.newPocketQueueAdmin(
+                requester, PackagePublishingPocket.UPDATES)
+        job = self.createCopyJobForSPPH(
+            spph, archive, archive,
+            target_pocket=PackagePublishingPocket.UPDATES,
+            include_binaries=True, requester=requester,
+            auto_approve=True, phased_update_percentage=0)
+        self.assertEqual(0, job.phased_update_percentage)
+        self.runJob(job)
+        self.assertEqual(JobStatus.COMPLETED, job.status)
+
+        # Make sure packages were copied with the correct
+        # phased_update_percentage.
+        copied_binaries = archive.getAllPublishedBinaries(
+            name=u"copyme", pocket=PackagePublishingPocket.UPDATES)
+        self.assertNotEqual(0, copied_binaries.count())
+        for binary in copied_binaries:
+            self.assertEqual(0, binary.phased_update_percentage)
+
     def test_findMatchingDSDs_matches_all_DSDs_for_job(self):
         # findMatchingDSDs finds matching DSDs for any of the packages
         # in the job.