tests: Fix the image minimizer test dnf usage

If the host dnf repos contain $releasever then using --installroot will
fail because it tries to use a rpmdb in the installroot, which starts
out empty. Passing --releasever=/ will use the releasever from the host.
This commit is contained in:
Brian C. Lane 2022-02-14 09:29:05 -08:00 committed by Brian C. Lane
parent 105e6891f6
commit c9e90ec0b2

View File

@ -5,10 +5,10 @@ import unittest
from minimizer import ImageMinimizer from minimizer import ImageMinimizer
class BuildStampTestCase(unittest.TestCase): class MinimizerTestCase(unittest.TestCase):
def test_minimizer_ok(self): def test_minimizer_ok(self):
with tempfile.TemporaryDirectory(prefix="minimize.test.") as rootdir: with tempfile.TemporaryDirectory(prefix="minimize.test.") as rootdir:
check_call(["dnf", "--installroot", rootdir, "install", "-y", \ check_call(["dnf", "--releasever=/", "--installroot", rootdir, "install", "-y", \
"filesystem"]) "filesystem"])
im = ImageMinimizer("./tests/image-minimizer/im-script.txt", rootdir, False, False) im = ImageMinimizer("./tests/image-minimizer/im-script.txt", rootdir, False, False)