From ee3be65aa1348798d385ead9b80c6a6ada21d6b0 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 15 Aug 2017 14:34:55 +0300 Subject: oeqa: fix dnf tests Rename one dnf runtime test that it will recognized as a python module and thus also found by the oe test loader. Also, fix value of TEST_SUITES in dnf selftest so that all test dependencies are satisfied and the runtime test may be successfully run from there. Signed-off-by: Markus Lehtonen Signed-off-by: Richard Purdie --- .../lib/oeqa/runtime/cases/dnf-runtime.py | 42 ---------------------- .../lib/oeqa/runtime/cases/dnf_runtime.py | 42 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py create mode 100644 meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py (limited to 'meta-selftest') diff --git a/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py b/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py deleted file mode 100644 index 123e7259f1..0000000000 --- a/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py +++ /dev/null @@ -1,42 +0,0 @@ -from oeqa.core.decorator.depends import OETestDepends -from oeqa.runtime.cases.dnf import DnfTest -from oeqa.utils.httpserver import HTTPService - -class DnfSelftest(DnfTest): - - @classmethod - def setUpClass(cls): - cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'), - cls.tc.target.server_ip) - cls.repo_server.start() - - @classmethod - def tearDownClass(cls): - cls.repo_server.stop() - - @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) - def test_verify_package_feeds(self): - """ - Summary: Check correct setting of PACKAGE_FEED_URIS var - Expected: 1. Feeds were correctly set for dnf - 2. Update recovers packages from host's repo - Author: Humberto Ibarra - Author: Alexander Kanavin - """ - # When we created an image, we had to supply fake ip and port - # for the feeds. Now we can patch the real ones into the config file. - import tempfile - temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name - self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file) - fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port)) - open(temp_file, "w").write(fixed_config) - self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo") - - import re - output_makecache = self.dnf('makecache') - self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache)) - - output_repoinfo = self.dnf('repoinfo') - matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P[0-9]+)", output_repoinfo, re.DOTALL) - self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo)) - self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo)) diff --git a/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py b/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py new file mode 100644 index 0000000000..123e7259f1 --- /dev/null +++ b/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py @@ -0,0 +1,42 @@ +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.cases.dnf import DnfTest +from oeqa.utils.httpserver import HTTPService + +class DnfSelftest(DnfTest): + + @classmethod + def setUpClass(cls): + cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'), + cls.tc.target.server_ip) + cls.repo_server.start() + + @classmethod + def tearDownClass(cls): + cls.repo_server.stop() + + @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) + def test_verify_package_feeds(self): + """ + Summary: Check correct setting of PACKAGE_FEED_URIS var + Expected: 1. Feeds were correctly set for dnf + 2. Update recovers packages from host's repo + Author: Humberto Ibarra + Author: Alexander Kanavin + """ + # When we created an image, we had to supply fake ip and port + # for the feeds. Now we can patch the real ones into the config file. + import tempfile + temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name + self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file) + fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port)) + open(temp_file, "w").write(fixed_config) + self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo") + + import re + output_makecache = self.dnf('makecache') + self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache)) + + output_repoinfo = self.dnf('repoinfo') + matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P[0-9]+)", output_repoinfo, re.DOTALL) + self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo)) + self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo)) -- cgit 1.2.3-korg