summaryrefslogtreecommitdiffstats
path: root/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py
diff options
context:
space:
mode:
authorHumberto Ibarra <humberto.ibarra.lopez@intel.com>2017-06-05 12:19:34 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-09 17:12:13 +0100
commitf1812e090b32f8c1bb33e4f26a246e5fb5e49c13 (patch)
treea005389b4c3351e98fea976ce7bcf042c8dbe024 /meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py
parent88aa35cdcdd43df418ca1e06143c13346a00bf77 (diff)
downloadpoky-f1812e090b32f8c1bb33e4f26a246e5fb5e49c13.tar.gz
runtime-test.py: Split different tests inside selftest.py
There were two completely different tests inside selftest.py, and the only reason for them to be together was that both needed the same mechanism to execute (run testimage from within selftest) This fixes the design issue and error-prone situation by separating these tests. In add a new module for dnf-runtime and also has an extra time added to running the tests, but it is minimal since the builds reuse data from previuous build. [YOCTO #11436] (From OE-Core rev: 2f6a506018973f0eaf1306555df3e74a3ab25680) Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py')
-rw-r--r--meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py42
1 files changed, 42 insertions, 0 deletions
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 @@
1from oeqa.core.decorator.depends import OETestDepends
2from oeqa.runtime.cases.dnf import DnfTest
3from oeqa.utils.httpserver import HTTPService
4
5class DnfSelftest(DnfTest):
6
7 @classmethod
8 def setUpClass(cls):
9 cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'),
10 cls.tc.target.server_ip)
11 cls.repo_server.start()
12
13 @classmethod
14 def tearDownClass(cls):
15 cls.repo_server.stop()
16
17 @OETestDepends(['dnf.DnfBasicTest.test_dnf_help'])
18 def test_verify_package_feeds(self):
19 """
20 Summary: Check correct setting of PACKAGE_FEED_URIS var
21 Expected: 1. Feeds were correctly set for dnf
22 2. Update recovers packages from host's repo
23 Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
24 Author: Alexander Kanavin <alexander.kanavin@intel.com>
25 """
26 # When we created an image, we had to supply fake ip and port
27 # for the feeds. Now we can patch the real ones into the config file.
28 import tempfile
29 temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name
30 self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file)
31 fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port))
32 open(temp_file, "w").write(fixed_config)
33 self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo")
34
35 import re
36 output_makecache = self.dnf('makecache')
37 self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache))
38
39 output_repoinfo = self.dnf('repoinfo')
40 matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P<n_pkgs>[0-9]+)", output_repoinfo, re.DOTALL)
41 self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo))
42 self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo))