dcavalca / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone

Blame SOURCES/0016-Run-tests-for-fill-sack-from-repos-in-cache-in-installroot..patch

31f77b
From 291071a937a1de398641f02002413678398e473c Mon Sep 17 00:00:00 2001
31f77b
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
31f77b
Date: Mon, 8 Feb 2021 08:25:46 +0100
31f77b
Subject: [PATCH] Run tests for fill_sack_from_repos_in_cache in installroot
31f77b
 (RhBug:1865803)
31f77b
31f77b
This prevents loading data (like failsafe) from host.
31f77b
31f77b
It also allows testing that there are no modules in the installroot not just
31f77b
no base-runtime* in test_with_modular_repo_without_modules_yaml.
31f77b
31f77b
https://bugzilla.redhat.com/show_bug.cgi?id=1865803
31f77b
---
31f77b
 tests/test_fill_sack_from_repos_in_cache.py | 4 +++-
31f77b
 1 file changed, 3 insertions(+), 1 deletion(-)
31f77b
31f77b
diff --git a/tests/test_fill_sack_from_repos_in_cache.py b/tests/test_fill_sack_from_repos_in_cache.py
31f77b
index 24b0d4598d..f27235bf84 100644
31f77b
--- a/tests/test_fill_sack_from_repos_in_cache.py
31f77b
+++ b/tests/test_fill_sack_from_repos_in_cache.py
31f77b
@@ -42,6 +42,7 @@ class FillSackFromReposInCacheTest(unittest.TestCase):
31f77b
     def _create_cache_for_repo(self, repopath, tmpdir):
31f77b
         conf = dnf.conf.MainConf()
31f77b
         conf.cachedir = os.path.join(tmpdir, "cache")
31f77b
+        conf.installroot = os.path.join(tmpdir)
31f77b
 
31f77b
         base = dnf.Base(conf=conf)
31f77b
 
31f77b
@@ -68,6 +69,7 @@ def _setUp_from_repo_path(self, original_repo_path):
31f77b
         # Prepare base for the actual test
31f77b
         conf = dnf.conf.MainConf()
31f77b
         conf.cachedir = os.path.join(self.tmpdir, "cache")
31f77b
+        conf.installroot = os.path.join(self.tmpdir)
31f77b
         self.test_base = dnf.Base(conf=conf)
31f77b
         repoconf = dnf.repo.Repo(TEST_REPO_NAME, conf)
31f77b
         repoconf.baseurl = self.repo_copy_path
31f77b
@@ -258,5 +260,5 @@ def test_with_modular_repo_without_modules_yaml(self):
31f77b
         self.assertEqual(packages[0].evr, "10.0-7")
31f77b
 
31f77b
         self.module_base = dnf.module.module_base.ModuleBase(self.test_base)
31f77b
-        modules, _ = self.module_base._get_modules("base-runtime*")
31f77b
+        modules, _ = self.module_base._get_modules("*")
31f77b
         self.assertEqual(len(modules), 0)