#1452 Fix wrong condition when reusing old gather phase results.
Merged 3 years ago by lsedlar. Opened 3 years ago by jkaluza.
jkaluza/pungi parent-compose-id  into  master

@@ -238,7 +238,7 @@ 

                      # The gather_lookaside_repos config allows setting multiple repourls

                      # using list, but `_update_config` always uses strings. Therefore we

                      # only try to filter out string_types.

-                     if isinstance(repourl, six.string_types):

+                     if not isinstance(repourl, six.string_types):

                          continue

                      if not repourl.startswith(compose.topdir):

                          per_arch_repos_to_compare[arch] = repourl

@@ -1238,6 +1238,26 @@ 

  

      @mock.patch("pungi.phases.gather.load_old_gather_result")

      @mock.patch("pungi.phases.gather.load_old_compose_config")

+     def test_reuse_update_gather_lookaside_repos_different_initial_repos_list(

+         self, load_old_compose_config, load_old_gather_result

+     ):

+         package_sets = self._prepare_package_sets(

+             load_old_gather_result, requires=[], provides=[]

+         )

+         compose = helpers.DummyCompose(self.topdir, {"gather_allow_reuse": True})

+         lookasides = compose.conf["gather_lookaside_repos"]

+         repos = ["http://localhost/real1.repo", "http://localhost/real2.repo"]

+         lookasides.append(("^Server$", {"x86_64": repos}))

+         load_old_compose_config.return_value = copy.deepcopy(compose.conf)

+ 

+         gather._update_config(compose, "Server", "x86_64", compose.topdir)

+         result = gather.reuse_old_gather_packages(

+             compose, "x86_64", compose.variants["Server"], package_sets

+         )

+         self.assertEqual(result, None)

+ 

+     @mock.patch("pungi.phases.gather.load_old_gather_result")

+     @mock.patch("pungi.phases.gather.load_old_compose_config")

      def test_reuse_no_old_file_cache(

          self, load_old_compose_config, load_old_gather_result

      ):

When list is used in gather_lookaside_repos, the Pungi currently
fails with an exception. This is caused by inverted condition
in the code which tries to filter-out the lookaside repos
generated during the Pungin execution pointing to different
compose variants.

Signed-off-by: Jan Kaluza jkaluza@redhat.com

rebased onto 4623536

3 years ago

Looks good to me. :thumbsup:

Pull-Request has been merged by lsedlar

3 years ago