summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParide Legovini <paride.legovini@canonical.com>2021-03-03 14:44:36 +0100
committerGitHub <noreply@github.com>2021-03-03 06:44:36 -0700
commit62f7a8b17f0528869662e987aa59a5c248c18e02 (patch)
tree4a0049c376aab3ec31ef253cbbba8b9803ddfe28
parenta10838a621f2eef3f97959ae8ffb80bc2cd3b5fd (diff)
downloadvyos-cloud-init-62f7a8b17f0528869662e987aa59a5c248c18e02.tar.gz
vyos-cloud-init-62f7a8b17f0528869662e987aa59a5c248c18e02.zip
Fix the TestApt tests using apt-key on Xenial and Hirsute (#823)
* Xenial issue The `apt-key finger` format changed since Xenial. Sample Xenial output: pub 4096R/991BC93C 2018-09-17 Key fingerprint = F6EC B376 2474 EDA9 D21B 7022 8719 20D1 991B Sample Focal output: pub rsa4096 2016-04-12 [SC] EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796 What didn't change is the format of the key fingerprint, which should be enough to ensure that the right key is in place across all the supported releases. * Hirsute issue TestApt::test_ppa_source also fails on Hirsute because of a difference in how the PPA keys are added. On Focla this command: add-apt-repository ppa:simplestreams-dev/trunk install /etc/apt/trusted.gpg.d/simplestreams-dev_ubuntu_trunk.gpg, while on Hirsute the file is names simplestreams-dev-ubuntu-trunk.gpg. The filename is part of the `apt-key finger` output, and this the test fails. Only checking for the presence of the key fingerprint in apt-key also covers this case. LP: #1916629
-rw-r--r--tests/integration_tests/modules/test_apt.py20
1 files changed, 3 insertions, 17 deletions
diff --git a/tests/integration_tests/modules/test_apt.py b/tests/integration_tests/modules/test_apt.py
index 5e3d474c..c0c8321c 100644
--- a/tests/integration_tests/modules/test_apt.py
+++ b/tests/integration_tests/modules/test_apt.py
@@ -86,25 +86,11 @@ EXPECTED_REGEXES = [
r"deb-src http://badsecurity.ubuntu.com/ubuntu [a-z]+-security multiverse",
]
-TEST_KEYSERVER_KEY = """\
-pub rsa1024 2013-12-09 [SC]
- 7260 0DB1 5B8E 4C8B 1964 B868 038A CC97 C660 A937
-uid [ unknown] Launchpad PPA for Ryan Harper
-"""
+TEST_KEYSERVER_KEY = "7260 0DB1 5B8E 4C8B 1964 B868 038A CC97 C660 A937"
-TEST_PPA_KEY = """\
-/etc/apt/trusted.gpg.d/simplestreams-dev_ubuntu_trunk.gpg
----------------------------------------------------------
-pub rsa4096 2016-05-04 [SC]
- 3552 C902 B4DD F7BD 3842 1821 015D 28D7 4416 14D8
-uid [ unknown] Launchpad PPA for simplestreams-dev
-"""
+TEST_PPA_KEY = "3552 C902 B4DD F7BD 3842 1821 015D 28D7 4416 14D8"
-TEST_KEY = """\
-pub rsa4096 2016-03-04 [SC]
- 1FF0 D853 5EF7 E719 E5C8 1B9C 083D 06FB E4D3 04DF
-uid [ unknown] Launchpad PPA for cloud init development team
-"""
+TEST_KEY = "1FF0 D853 5EF7 E719 E5C8 1B9C 083D 06FB E4D3 04DF"
@pytest.mark.ci