~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/archivepublisher/tests/test_dominator.py

  • Committer: Julian Edwards
  • Date: 2011-10-18 11:16:43 UTC
  • mto: This revision was merged to the branch mainline in revision 14169.
  • Revision ID: julian.edwards@canonical.com-20111018111643-7jw5hydoohag25nm
Add failing tests for new corner cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
        self.checkPublications(
235
235
            foo_10_all_bins, PackagePublishingStatus.SUPERSEDED)
236
236
 
 
237
    def test_any_superseded_by_all(self):
 
238
        # Set up a source, foo, which builds an architecture-dependent
 
239
        # binary, foo-bin.
 
240
        foo_10_src = self.getPubSource(
 
241
            sourcename="foo", version="1.0", architecturehintlist="i386",
 
242
            status=PackagePublishingStatus.PUBLISHED)
 
243
        [foo_10_i386_bin] = self.getPubBinaries(
 
244
            binaryname="foo-bin", status=PackagePublishingStatus.PUBLISHED,
 
245
            architecturespecific=True, version="1.0", pub_source=foo_10_src)
 
246
 
 
247
        # Now, make version 1.1 of foo, where foo-bin is now
 
248
        # architecture-independent.
 
249
        foo_11_src = self.getPubSource(
 
250
            sourcename="foo", version="1.1", architecturehintlist="all",
 
251
            status=PackagePublishingStatus.PUBLISHED)
 
252
        [foo_10_all_bin, foo_10_all_bin_2] = self.getPubBinaries(
 
253
            binaryname="foo-bin", status=PackagePublishingStatus.PUBLISHED,
 
254
            architecturespecific=False, version="1.1", pub_source=foo_11_src)
 
255
 
 
256
        dominator = Dominator(self.logger, self.ubuntutest.main_archive)
 
257
        dominator.judgeAndDominate(
 
258
            foo_10_src.distroseries, foo_10_src.pocket)
 
259
 
 
260
        # The source will be superseded.
 
261
        self.checkPublication(foo_10_src, PackagePublishingStatus.SUPERSEDED)
 
262
        # The arch-specific is superseded by the new arch-indep.
 
263
        self.checkPublication(
 
264
            foo_10_i386_bin, PackagePublishingStatus.SUPERSEDED)
 
265
 
 
266
    def test_schitzoid_package(self):
 
267
        # Test domination of a source that produces an arch-indep and an
 
268
        # arch-all, that then switches both on the next version to the
 
269
        # other arch type.
 
270
        foo_10_src = self.getPubSource(
 
271
            sourcename="foo", version="1.0", architecturehintlist="i386",
 
272
            status=PackagePublishingStatus.PUBLISHED)
 
273
        [foo_10_i386_bin] = self.getPubBinaries(
 
274
            binaryname="foo-bin", status=PackagePublishingStatus.PUBLISHED,
 
275
            architecturespecific=True, version="1.0", pub_source=foo_10_src)
 
276
        [build] = foo_10_src.getBuilds()
 
277
        bpr = self.factory.makeBinaryPackageRelease(
 
278
            binarypackagename="foo-common", version="1.0", build=build,
 
279
            architecturespecific=False)
 
280
        foo_10_all_bins = self.publishBinaryInArchive(
 
281
            bpr, self.ubuntutest.main_archive, pocket=foo_10_src.pocket,
 
282
            status=PackagePublishingStatus.PUBLISHED)
 
283
 
 
284
        foo_11_src = self.getPubSource(
 
285
            sourcename="foo", version="1.1", architecturehintlist="i386",
 
286
            status=PackagePublishingStatus.PUBLISHED)
 
287
        [foo_11_i386_bin] = self.getPubBinaries(
 
288
            binaryname="foo-common", status=PackagePublishingStatus.PUBLISHED,
 
289
            architecturespecific=True, version="1.1", pub_source=foo_11_src)
 
290
        [build] = foo_11_src.getBuilds()
 
291
        bpr = self.factory.makeBinaryPackageRelease(
 
292
            binarypackagename="foo-bin", version="1.1", build=build,
 
293
            architecturespecific=False)
 
294
        foo_11_all_bins = self.publishBinaryInArchive(
 
295
            bpr, self.ubuntutest.main_archive, pocket=foo_11_src.pocket,
 
296
            status=PackagePublishingStatus.PUBLISHED)
 
297
 
 
298
        dominator = Dominator(self.logger, self.ubuntutest.main_archive)
 
299
        dominator.judgeAndDominate(foo_10_src.distroseries, foo_10_src.pocket)
 
300
 
 
301
        self.checkPublications(foo_10_all_bins + [foo_10_i386_bin],
 
302
                               PackagePublishingStatus.SUPERSEDED)
 
303
 
 
304
 
 
305
 
237
306
 
238
307
class TestDomination(TestNativePublishingBase):
239
308
    """Test overall domination procedure."""
288
357
        self.ubuntutest['breezy-autotest'].status = (
289
358
            SeriesStatus.OBSOLETE)
290
359
 
291
 
    def test_any_superseded_by_all(self):
292
 
        # Set up a source, foo, which builds an architecture-dependent
293
 
        # binary, foo-bin.
294
 
        foo_10_src = self.getPubSource(
295
 
            sourcename="foo", version="1.0", architecturehintlist="i386",
296
 
            status=PackagePublishingStatus.PUBLISHED)
297
 
        [foo_10_i386_bin] = self.getPubBinaries(
298
 
            binaryname="foo-bin", status=PackagePublishingStatus.PUBLISHED,
299
 
            architecturespecific=True, version="1.0", pub_source=foo_10_src)
300
 
 
301
 
        # Now, make version 1.1 of foo, where foo-bin is now
302
 
        # architecture-independent.
303
 
        foo_11_src = self.getPubSource(
304
 
            sourcename="foo", version="1.1", architecturehintlist="all",
305
 
            status=PackagePublishingStatus.PUBLISHED)
306
 
        [foo_10_all_bin, foo_10_all_bin_2] = self.getPubBinaries(
307
 
            binaryname="foo-bin", status=PackagePublishingStatus.PUBLISHED,
308
 
            architecturespecific=False, version="1.1", pub_source=foo_11_src)
309
 
 
310
 
        dominator = Dominator(self.logger, self.ubuntutest.main_archive)
311
 
        dominator.judgeAndDominate(
312
 
            foo_10_src.distroseries, foo_10_src.pocket)
313
 
 
314
 
        # The source will be superseded.
315
 
        self.checkPublication(foo_10_src, PackagePublishingStatus.SUPERSEDED)
316
 
        # The arch-specific is superseded by the new arch-indep.
317
 
        self.checkPublication(
318
 
            foo_10_i386_bin, PackagePublishingStatus.SUPERSEDED)
319
 
 
320
360
 
321
361
def make_spphs_for_versions(factory, versions):
322
362
    """Create publication records for each of `versions`.