summaryrefslogtreecommitdiffstats
path: root/meta-selftest/lib/oeqa/runtime/cases/selftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta-selftest/lib/oeqa/runtime/cases/selftest.py')
-rw-r--r--meta-selftest/lib/oeqa/runtime/cases/selftest.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/meta-selftest/lib/oeqa/runtime/cases/selftest.py b/meta-selftest/lib/oeqa/runtime/cases/selftest.py
index 19de740623..e4985a6edd 100644
--- a/meta-selftest/lib/oeqa/runtime/cases/selftest.py
+++ b/meta-selftest/lib/oeqa/runtime/cases/selftest.py
@@ -1,5 +1,7 @@
1from oeqa.runtime.case import OERuntimeTestCase 1from oeqa.runtime.case import OERuntimeTestCase
2from oeqa.core.decorator.depends import OETestDepends 2from oeqa.core.decorator.depends import OETestDepends
3from oeqa.runtime.cases.dnf import DnfTest
4from oeqa.utils.httpserver import HTTPService
3 5
4class Selftest(OERuntimeTestCase): 6class Selftest(OERuntimeTestCase):
5 7
@@ -29,3 +31,43 @@ class Selftest(OERuntimeTestCase):
29 31
30 (status, output) = self.target.run("socat -V") 32 (status, output) = self.target.run("socat -V")
31 self.assertNotEqual(status, 0, msg="socat is still installed") 33 self.assertNotEqual(status, 0, msg="socat is still installed")
34
35
36class DnfSelftest(DnfTest):
37
38 @classmethod
39 def setUpClass(cls):
40 cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'),
41 cls.tc.target.server_ip)
42 cls.repo_server.start()
43
44 @classmethod
45 def tearDownClass(cls):
46 cls.repo_server.stop()
47
48 @OETestDepends(['ssh.SSHTest.test_ssh'])
49 def test_verify_package_feeds(self):
50 """
51 Summary: Check correct setting of PACKAGE_FEED_URIS var
52 Expected: 1. Feeds were correctly set for dnf
53 2. Update recovers packages from host's repo
54 Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
55 Author: Alexander Kanavin <alexander.kanavin@intel.com>
56 """
57 # When we created an image, we had to supply fake ip and port
58 # for the feeds. Now we can patch the real ones into the config file.
59 import tempfile
60 temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name
61 self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file)
62 fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port))
63 open(temp_file, "w").write(fixed_config)
64 self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo")
65
66 import re
67 output_makecache = self.dnf('makecache')
68 self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache))
69
70 output_repoinfo = self.dnf('repoinfo')
71 matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P<n_pkgs>[0-9]+)", output_repoinfo, re.DOTALL)
72 self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo))
73 self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo))