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