On 08/11/2017 01:51 PM, Markus Lehtonen wrote:
--- a/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py
+++ b/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py
@@ -31,12 +31,24 @@ class DnfSelftest(DnfTest):
          temp_file = os.path.join(self.temp_dir.name, 'tmp.repo')
          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))
+        fixed_config += 'repo_gpgcheck=1\n'
          with open(temp_file, "w") as f:
              f.write(fixed_config)
          self.tc.target.copyTo(temp_file, 
"/etc/yum.repos.d/oe-remote-repo.repo")
+ # First try should fail as the gpg pubkey is not available for dnf
          import re
          output_makecache = self.dnf('makecache')
+        self.assertTrue(re.match(r".*Failed to synchronize cache", output_makecache, 
re.DOTALL) is not None, msg = "dnf makecache should have failed: %s" %(output_makecache))
+
+        # Add public key to dnf config -> now we should succeed
+        fixed_config += 
'gpgkey=file:///etc/pki/packagefeed-gpg/PACKAGEFEED-GPG-KEY-%s\n' % 
self.tc.td['DISTRO_VERSION']
+        with open(temp_file, "w") as f:
+            f.write(fixed_config)
+        self.tc.target.copyTo(temp_file, 
"/etc/yum.repos.d/oe-remote-repo.repo")
+
+        output_makecache = self.dnf('-y makecache')
+        self.assertTrue(re.match(r".*Failed to synchronize cache", output_makecache, 
re.DOTALL) is None, msg = "dnf makecache failed to synchronize repo: %s" 
%(output_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')


Wait a moment. If feed signing is enabled, then dnf's "repo_gpgcheck", and "gpgkey" settings should be configured and working by default. You shouldn't fix them after the fact in the test. Please add the necessary code to insert_feeds_uris() in package_manager.py.

Then you can simply test that:
a) repository access ('dnf makecache' and 'dnf repoinfo') works without error. b) the signatures are indeed present in the feed configuration ('repoinfo' would probably print that)

Alex
--
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to