Fix tests for createrepo
Tests for createrepo failed when pungi is installed in system. JIRA: RHELCMP-6209 Signed-off-by: Dominik Rumian <drumian@redhat.com>
This commit is contained in:
parent
9cd42a2b5e
commit
7c3e8d4276
@ -39,6 +39,7 @@ from ..wrappers.createrepo import CreaterepoWrapper
|
||||
from ..wrappers.scm import get_dir_from_scm
|
||||
from .base import PhaseBase
|
||||
|
||||
CACHE_TOPDIR = "/var/cache/pungi/createrepo_c/"
|
||||
createrepo_lock = threading.Lock()
|
||||
createrepo_dirs = set()
|
||||
|
||||
@ -192,7 +193,7 @@ def create_variant_repo(
|
||||
|
||||
if compose.conf["createrepo_enable_cache"]:
|
||||
cachedir = os.path.join(
|
||||
"/var/cache/pungi/createrepo_c/",
|
||||
CACHE_TOPDIR,
|
||||
"%s-%s" % (compose.conf["release_short"], os.getuid()),
|
||||
)
|
||||
if not os.path.exists(cachedir):
|
||||
|
@ -185,13 +185,15 @@ class TestCreateVariantRepo(PungiTestCase):
|
||||
repo = CreaterepoWrapperCls.return_value
|
||||
copy_fixture("server-rpms.json", compose.paths.compose.metadata("rpms.json"))
|
||||
|
||||
create_variant_repo(
|
||||
compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset
|
||||
)
|
||||
with mock.patch("pungi.phases.createrepo.CACHE_TOPDIR", self.topdir):
|
||||
create_variant_repo(
|
||||
compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset
|
||||
)
|
||||
|
||||
list_file = (
|
||||
self.topdir + "/work/x86_64/repo_package_list/Server.x86_64.rpm.conf"
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)
|
||||
)
|
||||
@ -214,7 +216,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
||||
use_xz=False,
|
||||
extra_args=[],
|
||||
cachedir=os.path.join(
|
||||
"/var/cache/pungi/createrepo_c/",
|
||||
self.topdir,
|
||||
"%s-%s" % (compose.conf["release_short"], os.getuid()),
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user