launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02019
[Merge] lp:~stevenk/launchpad/derivedistroseries-api-qafail-once-more into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/derivedistroseries-api-qafail-once-more into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch finally fixes the end-to-end test of deriving a distro series via the API, having the cronscript run to initialise the new series, and having the new series be initialised correctly.
My main problems with the way I wrote this code originally is that my testing was nowhere near enough complete enough, so I hit problems during QA, not earlier. This branch should fix all of the remaining problems.
I have QA'd this branch on dogfood and confirmed it worked before making the MP as Needs Review.
--
https://code.launchpad.net/~stevenk/launchpad/derivedistroseries-api-qafail-once-more/+merge/41820
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/derivedistroseries-api-qafail-once-more into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-11-13 03:36:46 +0000
+++ database/schema/security.cfg 2010-11-25 05:04:13 +0000
@@ -938,13 +938,13 @@
groups=script
public.archive = SELECT
public.archivepermission = SELECT, INSERT
-public.binarypackagebuild = SELECT
+public.binarypackagebuild = SELECT, INSERT
public.binarypackagename = SELECT
public.binarypackagepublishinghistory = SELECT, INSERT
public.binarypackagerelease = SELECT
-public.buildfarmjob = SELECT
-public.buildpackagejob = SELECT
-public.buildqueue = SELECT
+public.buildfarmjob = SELECT, INSERT
+public.buildpackagejob = SELECT, INSERT
+public.buildqueue = SELECT, INSERT, UPDATE
public.component = SELECT
public.componentselection = SELECT, INSERT
public.distribution = SELECT
@@ -952,8 +952,11 @@
public.distroarchseries = SELECT, INSERT
public.distroseries = SELECT, UPDATE
public.flatpackagesetinclusion = SELECT, INSERT
-public.job = SELECT, UPDATE
-public.packagebuild = SELECT
+public.gpgkey = SELECT
+public.job = SELECT, INSERT, UPDATE
+public.libraryfilealias = SELECT
+public.libraryfilecontent = SELECT
+public.packagebuild = SELECT, INSERT
public.packageset = SELECT, INSERT
public.packagesetgroup = SELECT, INSERT
public.packagesetinclusion = SELECT, INSERT
@@ -961,6 +964,7 @@
public.packageupload = SELECT
public.packaging = SELECT, INSERT
public.person = SELECT
+public.processor = SELECT
public.processorfamily = SELECT
public.section = SELECT
public.sectionselection = SELECT, INSERT
@@ -968,6 +972,7 @@
public.sourcepackagename = SELECT
public.sourcepackagepublishinghistory = SELECT, INSERT
public.sourcepackagerelease = SELECT
+public.sourcepackagereleasefile = SELECT
[sync_packages]
type=user
=== modified file 'lib/lp/soyuz/tests/test_initialisedistroseriesjob.py'
--- lib/lp/soyuz/tests/test_initialisedistroseriesjob.py 2010-11-04 12:12:33 +0000
+++ lib/lp/soyuz/tests/test_initialisedistroseriesjob.py 2010-11-25 05:04:13 +0000
@@ -1,6 +1,8 @@
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+__metaclass__ = type
+
import os
import subprocess
import sys
@@ -12,6 +14,8 @@
from canonical.config import config
from canonical.testing import LaunchpadZopelessLayer
+from lp.buildmaster.enums import BuildStatus
+from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.soyuz.interfaces.distributionjob import (
IInitialiseDistroSeriesJobSource,
)
@@ -98,7 +102,7 @@
self.assertEqual(naked_job.packagesets, packagesets)
self.assertEqual(naked_job.rebuild, False)
- def test_job(self):
+ def _create_child(self):
pf = self.factory.makeProcessorFamily()
pf.addProcessor('x86', '', '')
parent = self.factory.makeDistroSeries()
@@ -128,6 +132,10 @@
# Make sure everything hits the database, switching db users
# aborts.
transaction.commit()
+ return parent, child
+
+ def test_job(self):
+ parent, child = self._create_child()
job = getUtility(IInitialiseDistroSeriesJobSource).create(child)
self.layer.switchDbUser('initialisedistroseries')
@@ -136,6 +144,22 @@
self.assertEqual(parent.sourcecount, child.sourcecount)
self.assertEqual(parent.binarycount, child.binarycount)
+ def test_job_with_arguments(self):
+ parent, child = self._create_child()
+ arch = parent.nominatedarchindep.architecturetag
+ job = getUtility(IInitialiseDistroSeriesJobSource).create(
+ child, packagesets=('test1',), arches=(arch,), rebuild=True)
+ self.layer.switchDbUser('initialisedistroseries')
+
+ job.run()
+ child.updatePackageCount()
+ builds = child.getBuildRecords(
+ build_state=BuildStatus.NEEDSBUILD,
+ pocket=PackagePublishingPocket.RELEASE)
+ self.assertEqual(child.sourcecount, 1)
+ self.assertEqual(child.binarycount, 0)
+ self.assertEqual(builds.count(), 1)
+
def test_cronscript(self):
script = os.path.join(
config.root, 'cronscripts', 'initialise_distro_series.py')
Follow ups