#9399 Nightly tests(rawhide): test_epn not compatible with dnf5
Closed: fixed by frenaud. Opened by frenaud.

Issue

The nightly test test_integration/test_epn.py::TestEPN::test_EPN_config_file is not compatible with dnf5. It is using the command /usr/bin/dnf -y --downloaddir /tmp/dir --downloadonly install *ipa-client-epn but dnf5 does not recognize the --downloaddir option.

See for instance PR #2773 with the following logs and report:

cls = <class 'ipatests.test_integration.test_epn.TestEPN'>
mh = <pytest_multihost.plugin.MultihostFixture object at 0x7f8f2b805390>
    @classmethod
    def install(cls, mh):
        # External DNS is only available before install so cache a copy
        # of the *ipa-epn-client package so we can experimentally remove
        # it later.
        #
        # Notes:
        # - A package can't be downloaded that is already installed so we
        #   have to remove it first.
        # - dnf cleans up previously downloaded locations so make a copy it
        #   doesn't know about.
        # - Adds a class variable, pkg, containing the package name of
        #   the downloaded *ipa-client-epn rpm.
        hosts = [cls.master, cls.clients[0]]
        tasks.uninstall_packages(cls.clients[0],EPN_PKG)
>       pkgdir = tasks.download_packages(cls.clients[0], EPN_PKG)
test_integration/test_epn.py:299: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pytest_ipa/integration/tasks.py:2549: in download_packages
    host.run_command(install_cmd + pkgs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <ipatests.pytest_ipa.integration.host.Host client1.ipa.test (client)>
argv = ['/usr/bin/dnf', '-y', '--downloaddir', '/tmp/f811f8a9-64ea-488d-b528-81ee65cb43b1', '--downloadonly', 'install', ...]
set_env = True, stdin_text = None, log_stdout = True, raiseonerr = True
cwd = None, bg = False, encoding = 'utf-8', ok_returncode = 0
    def run_command(self, argv, set_env=True, stdin_text=None,
                    log_stdout=True, raiseonerr=True,
                    cwd=None, bg=False, encoding='utf-8', ok_returncode=0):
        """Wrapper around run_command to log stderr on raiseonerr=True
        :param ok_returncode: return code considered to be correct,
                              you can pass an integer or sequence of integers
        """
        result = super().run_command(
            argv, set_env=set_env, stdin_text=stdin_text,
            log_stdout=log_stdout, raiseonerr=False, cwd=cwd, bg=bg,
            encoding=encoding
        )
        # in FIPS mode SSH may print noise to stderr, remove the string
        # "FIPS mode initialized" + optional newline.
        result.stderr_bytes = FIPS_NOISE_RE.sub(b'', result.stderr_bytes)
        try:
            result_ok = result.returncode in ok_returncode
        except TypeError:
            result_ok = result.returncode == ok_returncode
        if not result_ok and raiseonerr:
            result.log.error('stderr: %s', result.stderr_text)
>           raise subprocess.CalledProcessError(
                result.returncode, argv,
                result.stdout_text, result.stderr_text
            )
E           subprocess.CalledProcessError: Command '['/usr/bin/dnf', '-y', '--downloaddir', '/tmp/f811f8a9-64ea-488d-b528-81ee65cb43b1', '--downloadonly', 'install', '*ipa-client-epn']' returned non-zero exit status 2.
pytest_ipa/integration/host.py:202: CalledProcessError
 -----------------------------Captured stderr setup------------------------------ 
ipa: ERROR: stderr: Unknown argument "--downloaddir" for command "dnf5". Add "--help" for more information about the arguments.

Rawhide starts shipping dnf5 which has a few differences with dnf. The test needs to be adapted.


Metadata Update from @frenaud:
- Issue assigned to frenaud

Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/6899

master:

  • ce9346e74e98a73c927bda5d294e9bab2785c713 ipatests: use dnf download to download pkgs

ipa-4-10:

  • 85f8f6efc9d07ee207901d61c39fa04b22df02d7 ipatests: use dnf download to download pkgs

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata