From b8ec84d3743fadfa585d6b13d69e0925b9733a30 Mon Sep 17 00:00:00 2001 From: Bruno Goncalves Date: Jun 07 2017 13:49:08 +0000 Subject: Merge branch 'master' into f26 --- diff --git a/tests/resources/installed_packages/all_installed_pkgs_docker.txt b/tests/resources/installed_packages/all_installed_pkgs_docker.txt index 8374b98..ed4a718 100644 --- a/tests/resources/installed_packages/all_installed_pkgs_docker.txt +++ b/tests/resources/installed_packages/all_installed_pkgs_docker.txt @@ -12,6 +12,7 @@ cyrus-sasl-lib elfutils-libelf expat fedora-modular-release +fedora-modular-repos filesystem gawk glib2 diff --git a/tests/resources/installed_packages/all_installed_pkgs_nspawn.txt b/tests/resources/installed_packages/all_installed_pkgs_nspawn.txt index b286d8b..286f528 100644 --- a/tests/resources/installed_packages/all_installed_pkgs_nspawn.txt +++ b/tests/resources/installed_packages/all_installed_pkgs_nspawn.txt @@ -25,6 +25,7 @@ elfutils-libs emacs-filesystem expat fedora-modular-release +fedora-modular-repos filesystem gawk gc diff --git a/tests/setup.py b/tests/setup.py index 4648717..d7b1acf 100755 --- a/tests/setup.py +++ b/tests/setup.py @@ -101,53 +101,20 @@ class BaseRuntimeSetupDocker(Test, module_framework.CommonFunctions): self.log.info("command '%s' succeeded with output:\n%s" % (cmd, cmd_output)) - def _configure_mock_microdnf(self): - """ - Configure mock chroot for microdnf so it carrys into the docker image - """ - - # fetch the dnf.conf file from the mock chroot that was conveniently - # created based on the yum.conf value in the mock configuration file - tmpdnfcfg = tempfile.NamedTemporaryFile(delete=False) - self._run_command('mock -r %s --copyout /etc/dnf/dnf.conf %s' % - (self.mockcfg, tmpdnfcfg.name)) - - with open(tmpdnfcfg.name, 'r') as dnffile: - contents = dnffile.read() - self.log.info( - "Contents of original dnf.conf generated by mock:\n%s" % contents) - - # load the dnf.conf file and remove the [main] section so only the - # repo section(s) remain - config = configparser.ConfigParser() - config.read(tmpdnfcfg.name) - self.log.info("Found the following configuration section(s): %s" % - ' '.join(config.sections())) - if 'main' in config: - del config['main'] - - # write out the cleaned up repo configuration - tmpyumcfg = tempfile.NamedTemporaryFile(delete=False) - with open(tmpyumcfg.name, 'w') as repofile: - config.write(repofile, space_around_delimiters=False) - - with open(tmpyumcfg.name, 'r') as yumfile: - contents = yumfile.read() - self.log.info("Contents of revised yum repo config:\n%s" % contents) - - # copy the new yum repo configuration file into the mock chroot - self._run_command( - 'mock -r %s --copyin %s /etc/yum.repos.d/build.repo' % (self.mockcfg, tmpyumcfg.name)) - self._run_command( - 'mock -r %s --chroot "chmod 644 /etc/yum.repos.d/build.repo"' % self.mockcfg) - - # remove the temporary files - os.remove(tmpdnfcfg.name) - os.remove(tmpyumcfg.name) - - # /etc/pki/rpm-gpg directory must exist or microdnf will explode - self._run_command( - 'mock -r %s --chroot "mkdir -p -m=755 /etc/pki/rpm-gpg"' % self.mockcfg) + def _set_dnf_conf(self): + filename = "/etc/dnf/dnf.conf" + path = "/var/lib/mock/" + self.mock_root + "/root" + filename + + conf = "EOF\n" + conf += "[main]\n" + conf += "gpgcheck=1\n" + conf += "installonly_limit=3\n" + conf += "clean_requirements_on_remove=True\n" + conf += "EOF\n" + + cmd = "sudo tee %s << %s" % (path, conf) + self._run_command(cmd) + def testCreateDockerImage(self): @@ -165,8 +132,7 @@ class BaseRuntimeSetupDocker(Test, module_framework.CommonFunctions): # Initialize chroot with mock self._run_command('mock -r %s --init' % self.mockcfg) - # Configure mock chroot for microdnf so it carrys into the docker image - self._configure_mock_microdnf() + self._set_dnf_conf() # check if "sudo" allows us to tar up the chroot without a password # Note: this must be configured in "sudoers" to work! diff --git a/tests/smoke.py b/tests/smoke.py index c00af51..f7c1fa8 100644 --- a/tests/smoke.py +++ b/tests/smoke.py @@ -278,6 +278,15 @@ class BaseRuntimeSmokeTest(module_framework.AvocadoTest): except: self.error("Could not remove %s" % lang["pkg"]) + def test_dnf(self): + """ + Check if DNF is able to install a package + """ + package = "tar" + self.run("microdnf install dnf") + self.run("dnf install -y %s" % package) + self.run("dnf remove -y %s" % package) + self.run("microdnf remove dnf") def _prepare_compiler_test_directory(self):