示例#1
0
    def test_security_update_priority_testing(self, publish, *args):
        with self.db_factory() as db:
            up = db.query(Update).one()
            up.type = UpdateType.security
            up.request = UpdateRequest.testing
            user = db.query(User).first()

            # Create a security update for a different release
            release = Release(
                name=u'F18', long_name=u'Fedora 18',
                id_prefix=u'FEDORA', version=u'18',
                dist_tag=u'f18', stable_tag=u'f18-updates',
                testing_tag=u'f18-updates-testing',
                candidate_tag=u'f18-updates-candidate',
                pending_testing_tag=u'f18-updates-testing-pending',
                pending_stable_tag=u'f18-updates-pending',
                override_tag=u'f18-override',
                branch=u'f18')
            db.add(release)
            build = Build(nvr=u'bodhi-2.0-1.fc18', release=release,
                          package=up.builds[0].package)
            db.add(build)
            update = Update(
                title=u'bodhi-2.0-1.fc18',
                builds=[build], user=user,
                status=UpdateStatus.testing,
                request=UpdateRequest.stable,
                notes=u'Useful details!', release=release)
            update.type = UpdateType.enhancement
            db.add(update)

            # Wipe out the tag cache so it picks up our new release
            Release._tag_cache = None

        self.msg['body']['msg']['updates'] += ['bodhi-2.0-1.fc18']

        self.masher.consume(self.msg)

        # Ensure that F17 updates-testing runs before F18
        calls = publish.mock_calls
        self.assertEquals(calls[1], mock.call(
            msg={'repo': u'f17-updates-testing',
                 'updates': [u'bodhi-2.0-1.fc17']},
            force=True,
            topic='mashtask.mashing'))
        self.assertEquals(calls[3], mock.call(
            msg={'success': True, 'repo': 'f17-updates-testing'},
            force=True,
            topic='mashtask.complete'))
        self.assertEquals(calls[4], mock.call(
            msg={'repo': u'f18-updates',
                 'updates': [u'bodhi-2.0-1.fc18']},
            force=True,
            topic='mashtask.mashing'))
        self.assertEquals(calls[-1], mock.call(
            msg={'success': True, 'repo': 'f18-updates'},
            force=True,
            topic='mashtask.complete'))
示例#2
0
    def test_security_update_priority_testing(self, publish, *args):
        with self.db_factory() as db:
            up = db.query(Update).one()
            up.type = UpdateType.security
            up.request = UpdateRequest.testing
            user = db.query(User).first()

            # Create a security update for a different release
            release = Release(
                name=u'F18', long_name=u'Fedora 18',
                id_prefix=u'FEDORA', version=u'18',
                dist_tag=u'f18', stable_tag=u'f18-updates',
                testing_tag=u'f18-updates-testing',
                candidate_tag=u'f18-updates-candidate',
                pending_testing_tag=u'f18-updates-testing-pending',
                pending_stable_tag=u'f18-updates-pending',
                override_tag=u'f18-override',
                branch=u'f18')
            db.add(release)
            build = Build(nvr=u'bodhi-2.0-1.fc18', release=release,
                          package=up.builds[0].package)
            db.add(build)
            update = Update(
                title=u'bodhi-2.0-1.fc18',
                builds=[build], user=user,
                status=UpdateStatus.testing,
                request=UpdateRequest.stable,
                notes=u'Useful details!', release=release)
            update.type = UpdateType.enhancement
            db.add(update)

            # Wipe out the tag cache so it picks up our new release
            Release._tag_cache = None

        self.msg['body']['msg']['updates'] += ['bodhi-2.0-1.fc18']

        self.masher.consume(self.msg)

        # Ensure that F17 updates-testing runs before F18
        calls = publish.mock_calls
        self.assertEquals(calls[1], mock.call(
            msg={'repo': u'f17-updates-testing',
                 'updates': [u'bodhi-2.0-1.fc17']},
            force=True,
            topic='mashtask.mashing'))
        self.assertEquals(calls[3], mock.call(
            msg={'success': True, 'repo': 'f17-updates-testing'},
            force=True,
            topic='mashtask.complete'))
        self.assertEquals(calls[4], mock.call(
            msg={'repo': u'f18-updates',
                 'updates': [u'bodhi-2.0-1.fc18']},
            force=True,
            topic='mashtask.mashing'))
        self.assertEquals(calls[-1], mock.call(
            msg={'success': True, 'repo': 'f18-updates'},
            force=True,
            topic='mashtask.complete'))
示例#3
0
def populate(db):
    user = User(name=u'guest')
    db.add(user)
    anonymous = User(name=u'anonymous')
    db.add(anonymous)
    provenpackager = Group(name=u'provenpackager')
    db.add(provenpackager)
    packager = Group(name=u'packager')
    db.add(packager)
    db.flush()
    user.groups.append(packager)
    release = Release(
        name=u'F17', long_name=u'Fedora 17',
        id_prefix=u'FEDORA', version=u'17',
        dist_tag=u'f17', stable_tag=u'f17-updates',
        testing_tag=u'f17-updates-testing',
        candidate_tag=u'f17-updates-candidate',
        pending_testing_tag=u'f17-updates-testing-pending',
        pending_stable_tag=u'f17-updates-pending',
        override_tag=u'f17-override',
        branch=u'f17')
    db.add(release)
    pkg = Package(name=u'bodhi')
    db.add(pkg)
    user.packages.append(pkg)
    build = Build(nvr=u'bodhi-2.0-1.fc17', release=release, package=pkg)
    db.add(build)
    testcase = TestCase(name=u'Wat')
    db.add(testcase)
    pkg.test_cases.append(testcase)
    update = Update(
        title=u'bodhi-2.0-1.fc17',
        builds=[build], user=user,
        request=UpdateRequest.testing,
        notes=u'Useful details!', release=release,
        date_submitted=datetime(1984, 11, 02),
        requirements=u'rpmlint',
        stable_karma=3, unstable_karma=-3,
    )
    update.type = UpdateType.bugfix
    bug = Bug(bug_id=12345)
    db.add(bug)
    update.bugs.append(bug)
    cve = CVE(cve_id=u"CVE-1985-0110")
    db.add(cve)
    update.cves.append(cve)

    comment = Comment(karma=1, text=u"wow. amaze.")
    db.add(comment)
    comment.user = user
    update.comments.append(comment)
    update.karma = 1

    comment = Comment(karma=0, text=u"srsly.  pretty good.", anonymous=True)
    comment.user = anonymous
    db.add(comment)
    update.comments.append(comment)

    with mock.patch(target='uuid.uuid4', return_value='wat'):
        update.assign_alias()
    db.add(update)

    expiration_date = datetime.utcnow()
    expiration_date = expiration_date + timedelta(days=1)

    override = BuildrootOverride(build=build, submitter=user,
                                 notes=u'blah blah blah',
                                 expiration_date=expiration_date)
    db.add(override)

    db.flush()
示例#4
0
文件: __init__.py 项目: pcreech/bodhi
def populate(db):
    user = User(name=u'guest')
    db.add(user)
    anonymous = User(name=u'anonymous')
    db.add(anonymous)
    provenpackager = Group(name=u'provenpackager')
    db.add(provenpackager)
    packager = Group(name=u'packager')
    db.add(packager)
    db.flush()
    user.groups.append(packager)
    release = Release(name=u'F17',
                      long_name=u'Fedora 17',
                      id_prefix=u'FEDORA',
                      version=u'17',
                      dist_tag=u'f17',
                      stable_tag=u'f17-updates',
                      testing_tag=u'f17-updates-testing',
                      candidate_tag=u'f17-updates-candidate',
                      pending_testing_tag=u'f17-updates-testing-pending',
                      pending_stable_tag=u'f17-updates-pending',
                      override_tag=u'f17-override',
                      branch=u'f17')
    db.add(release)
    pkg = Package(name=u'bodhi')
    db.add(pkg)
    user.packages.append(pkg)
    build = Build(nvr=u'bodhi-2.0-1.fc17', release=release, package=pkg)
    db.add(build)
    testcase = TestCase(name=u'Wat')
    db.add(testcase)
    pkg.test_cases.append(testcase)
    update = Update(
        title=u'bodhi-2.0-1.fc17',
        builds=[build],
        user=user,
        request=UpdateRequest.testing,
        notes=u'Useful details!',
        release=release,
        date_submitted=datetime(1984, 11, 02),
        requirements=u'rpmlint',
        stable_karma=3,
        unstable_karma=-3,
    )
    update.type = UpdateType.bugfix
    bug = Bug(bug_id=12345)
    db.add(bug)
    update.bugs.append(bug)
    cve = CVE(cve_id=u"CVE-1985-0110")
    db.add(cve)
    update.cves.append(cve)

    comment = Comment(karma=1, text=u"wow. amaze.")
    db.add(comment)
    comment.user = user
    update.comments.append(comment)
    update.karma = 1

    comment = Comment(karma=0, text=u"srsly.  pretty good.", anonymous=True)
    comment.user = anonymous
    db.add(comment)
    update.comments.append(comment)

    with mock.patch(target='uuid.uuid4', return_value='wat'):
        update.assign_alias()
    db.add(update)

    expiration_date = datetime.utcnow()
    expiration_date = expiration_date + timedelta(days=1)

    override = BuildrootOverride(build=build,
                                 submitter=user,
                                 notes=u'blah blah blah',
                                 expiration_date=expiration_date)
    db.add(override)

    db.flush()
示例#5
0
    def test_security_updates_parallel(self, publish, *args):
        with self.db_factory() as db:
            up = db.query(Update).one()
            up.type = UpdateType.security
            up.status = UpdateStatus.testing
            up.request = UpdateRequest.stable
            user = db.query(User).first()

            # Create a security update for a different release
            release = Release(
                name=u"F18",
                long_name=u"Fedora 18",
                id_prefix=u"FEDORA",
                version=u"18",
                dist_tag=u"f18",
                stable_tag=u"f18-updates",
                testing_tag=u"f18-updates-testing",
                candidate_tag=u"f18-updates-candidate",
                pending_testing_tag=u"f18-updates-testing-pending",
                pending_stable_tag=u"f18-updates-pending",
                override_tag=u"f18-override",
                branch=u"f18",
            )
            db.add(release)
            build = Build(nvr=u"bodhi-2.0-1.fc18", release=release, package=up.builds[0].package)
            db.add(build)
            update = Update(
                title=u"bodhi-2.0-1.fc18",
                builds=[build],
                user=user,
                status=UpdateStatus.testing,
                request=UpdateRequest.stable,
                notes=u"Useful details!",
                release=release,
            )
            update.type = UpdateType.security
            db.add(update)

            # Wipe out the tag cache so it picks up our new release
            Release._tag_cache = None

        self.msg["body"]["msg"]["updates"] += ["bodhi-2.0-1.fc18"]

        self.masher.consume(self.msg)

        # Ensure that F18 and F17 run in parallel
        calls = publish.mock_calls
        if calls[1] == mock.call(
            msg={"repo": u"f18-updates", "updates": [u"bodhi-2.0-1.fc18"]}, force=True, topic="mashtask.mashing"
        ):
            self.assertEquals(
                calls[2],
                mock.call(
                    msg={"repo": u"f17-updates", "updates": [u"bodhi-2.0-1.fc17"]}, force=True, topic="mashtask.mashing"
                ),
            )
        elif calls[1] == self.assertEquals(
            calls[1],
            mock.call(
                msg={"repo": u"f17-updates", "updates": [u"bodhi-2.0-1.fc17"]}, force=True, topic="mashtask.mashing"
            ),
        ):
            self.assertEquals(
                calls[2],
                mock.call(
                    msg={"repo": u"f18-updates", "updates": [u"bodhi-2.0-1.fc18"]}, force=True, topic="mashtask.mashing"
                ),
            )
示例#6
0
    def test_security_update_priority(self, publish, *args):
        with self.db_factory() as db:
            up = db.query(Update).one()
            user = db.query(User).first()

            # Create a security update for a different release
            release = Release(
                name=u"F18",
                long_name=u"Fedora 18",
                id_prefix=u"FEDORA",
                version=u"18",
                dist_tag=u"f18",
                stable_tag=u"f18-updates",
                testing_tag=u"f18-updates-testing",
                candidate_tag=u"f18-updates-candidate",
                pending_testing_tag=u"f18-updates-testing-pending",
                pending_stable_tag=u"f18-updates-pending",
                override_tag=u"f18-override",
                branch=u"f18",
            )
            db.add(release)
            build = Build(nvr=u"bodhi-2.0-1.fc18", release=release, package=up.builds[0].package)
            db.add(build)
            update = Update(
                title=u"bodhi-2.0-1.fc18",
                builds=[build],
                user=user,
                status=UpdateStatus.testing,
                request=UpdateRequest.stable,
                notes=u"Useful details!",
                release=release,
            )
            update.type = UpdateType.security
            db.add(update)

            # Wipe out the tag cache so it picks up our new release
            Release._tag_cache = None

        self.msg["body"]["msg"]["updates"] += ["bodhi-2.0-1.fc18"]

        self.masher.consume(self.msg)

        # Ensure that F18 runs before F17
        calls = publish.mock_calls
        # Order of fedmsgs at the the moment:
        # masher.start
        # mashing f18
        # complete.stable (for each update)
        # errata.publish
        # mashtask.complete
        # mashing f17
        # complete.testing
        # mashtask.complete
        self.assertEquals(
            calls[1],
            mock.call(
                force=True, msg={"repo": u"f18-updates", "updates": [u"bodhi-2.0-1.fc18"]}, topic="mashtask.mashing"
            ),
        )
        self.assertEquals(
            calls[4], mock.call(force=True, msg={"success": True, "repo": "f18-updates"}, topic="mashtask.complete")
        )
        self.assertEquals(
            calls[5],
            mock.call(
                force=True,
                msg={"repo": u"f17-updates-testing", "updates": [u"bodhi-2.0-1.fc17"]},
                topic="mashtask.mashing",
            ),
        )
        self.assertEquals(
            calls[-1],
            mock.call(force=True, msg={"success": True, "repo": "f17-updates-testing"}, topic="mashtask.complete"),
        )