#1655 frontend: do not fork EOLed/disabled chroots
Merged 3 years ago by praiskup. Opened 3 years ago by praiskup.

@@ -329,7 +329,7 @@

  

              fcopr_dir = models.CoprDir(name=fcopr.name, copr=fcopr, main=True)

  

-             for chroot in list(copr.copr_chroots):

+             for chroot in list(copr.active_copr_chroots):

                  CoprChrootsLogic.create_chroot(self.user, fcopr, chroot.mock_chroot, chroot.buildroot_pkgs,

                                                 chroot.repos, comps=chroot.comps, comps_name=chroot.comps_name,

                                                 with_opts=chroot.with_opts, without_opts=chroot.without_opts)

@@ -57,6 +57,41 @@

                                 '6-hello-world': '00000013-hello-world',

                                 '11-new-package': '00000015-new-package'}}

  

+     @new_app_context

+     @mock.patch("flask.g")

+     @pytest.mark.usefixtures("f_users", "f_fork_prepare", "f_db")

+     def test_fork_copr_with_eoled_chroots(self, mc_flask_g):

+         mc_flask_g.user.name = self.u2.name

+ 

+         # disable fedora-17-i386

+         self.mc3.is_active = False

+         self.db.session.add(self.mc3)

+         self.db.session.commit()

+ 

+         new_copr, created = ComplexLogic.fork_copr(self.c2, self.u2, u"dstname")

+         assert created

+         assert [cc.mock_chroot.name for cc in new_copr.copr_chroots] == [

+             "fedora-17-x86_64"

+         ]

+ 

+         self.db.session.commit()

+         actions = ActionsLogic.get_many(ActionTypeEnum("fork")).all()

+         assert len(actions) == 1

+         data = json.loads(actions[0].data)

+         assert data["user"] == self.u2.name

+         assert data["copr"] == "dstname"

+         assert data["builds_map"] == {

+             'srpm-builds': {

+                 '00000008-whatsupthere-world': '00000012',

+                 '00000006-hello-world': '00000013',

+                 '00000010-new-package': '00000014',

+             },

+             'fedora-17-x86_64': {

+                 '8-whatsupthere-world': '00000012-whatsupthere-world',

+                 '6-hello-world': '00000013-hello-world',

+                 '10-new-package': '00000014-new-package',

+         }}

+ 

      def test_delete_expired_coprs(self, f_users, f_mock_chroots, f_coprs, f_builds, f_db):

          query = self.db.session.query(models.Copr)

  

This is the major cause of inconsistency in the DB from #1617. The rest
of problem instances is probably from the times when we had no EOL
policy.

Relates: #1617

rebased onto 4a1a66f8ce25b831907a8d13e4804003cbc56f92

3 years ago

Regardless of how the rest of the inconsistencies was caused, this PR surely makes sense.

+1

Does this manifest itself as copr_chroots with delete_after=None and delete_notify=None, or it is a different case? I am thinking about whether we can fix our database somehow, going to comment in #1617

Does this manifest itself as copr_chroots with delete_after=None and delete_notify=None

Yes.

rebased onto d0e5cfa

3 years ago

Commit d0e5cfa fixes this pull-request

Pull-Request has been merged by praiskup

3 years ago

Pull-Request has been merged by praiskup

3 years ago