@@ -75,6 +75,39 @@ def test_passwd_present(auto_container):
7575 assert auto_container .connection .file ("/etc/passwd" ).exists
7676
7777
78+ @pytest .mark .skipif (
79+ OS_VERSION in ("tumbleweed" ,)
80+ or OS_VERSION not in ALLOWED_BCI_REPO_OS_VERSIONS ,
81+ reason = "No repo available or no sensible gpgkey settings (openSUSE)" ,
82+ )
83+ def test_gpgkey_present_and_correct (auto_container ):
84+ """Check that the gpgkey setting in repos makes sense."""
85+ found_gpgkey = False
86+ for repo in (
87+ auto_container .connection .check_output (
88+ "grep -hE 'gpgkey.*=' /etc/zypp/repos.d/*.repo | sort -u"
89+ )
90+ .strip ()
91+ .splitlines ()
92+ ):
93+ k , _ , v = repo .partition ("=" )
94+ assert k .strip () == "gpgkey" , (
95+ f"Expected gpgkey setting but got { k .strip ()} "
96+ )
97+ assert v .strip ().startswith ("file:/usr/lib/rpm/" )
98+ assert auto_container .connection .file (v .strip ()[5 :]).exists , (
99+ f"GPG key file { v .strip ()[5 :]} does not exist in the container"
100+ )
101+ auto_container .connection .check_output (
102+ f"rpmkeys --import { v .strip ()[5 :]} "
103+ )
104+ found_gpgkey = True
105+
106+ assert found_gpgkey , (
107+ "No repo files with gpgkey setting found in /etc/zypp/repos.d/SLE_BCI*.repo"
108+ )
109+
110+
78111@pytest .mark .skipif (
79112 OS_VERSION not in ("tumbleweed" , "16.0" ),
80113 reason = "requires gconv modules" ,
0 commit comments