pytests: TestApt tests parsing the apt-key output fail on Xenial and Hirsute

Bug #1916629 reported by Paride Legovini
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Undecided
Unassigned

Bug Description

Sample error:

------------------------------------------------

    def test_keyserver(self, class_client: IntegrationInstance):
        """Test the apt keyserver functionality.

        Ported from
        tests/cloud_tests/testcases/modules/apt_configure_sources_keyserver.py
        """
        test_keyserver_contents = class_client.read_from_file(
            '/etc/apt/sources.list.d/test_keyserver.list'
        )

        assert (
            'http://ppa.launchpad.net/cloud-init-raharper/curtin-dev/ubuntu'
        ) in test_keyserver_contents

        keys = class_client.execute('apt-key finger')
> assert TEST_KEYSERVER_KEY in keys
E AssertionError: assert 'pub rsa1024 2013-12-09 [SC]\n 7260 0DB1 5B8E 4C8B 1964 B868 038A CC97 C660 A937\nuid [ unknown] Launchpad PPA for Ryan Harper\n' in '/etc/apt/trusted.gpg\n--------------------\npub 1024D/437D05B5 2004-09-12\n Key fingerprint = 6302 39CC 130E 1...erprint = 3552 C902 B4DD F7BD 3842 1821 015D 28D7 4416 14D8\nuid Launchpad PPA for simplestreams-dev'

class_client = <tests.integration_tests.instances.IntegrationLxdInstance object at 0x7fcfce989c88>
keys = '/etc/apt/trusted.gpg\n--------------------\npub 1024D/437D05B5 2004-09-12\n Key fingerprint = 6302 39CC 130E 1...erprint = 3552 C902 B4DD F7BD 3842 1821 015D 28D7 4416 14D8\nuid Launchpad PPA for simplestreams-dev'
self = <test_apt.TestApt object at 0x7fcfcfbcb1d0>
test_keyserver_contents = 'deb http://ppa.launchpad.net/cloud-init-raharper/curtin-dev/ubuntu xenial main'

------------------------------------------------

PR: https://github.com/canonical/cloud-init/pull/823

Revision history for this message
Paride Legovini (paride) wrote :

TestApt::test_ppa_source also fails on Hirsute because of a difference in how the PPA keys are added. This command

  add-apt-repository ppa:simplestreams-dev/trunk

on Focal install this file:

  /etc/apt/trusted.gpg.d/simplestreams-dev_ubuntu_trunk.gpg

while on Hirsute file is named:

  /etc/apt/trusted.gpg.d/simplestreams-dev-ubuntu-trunk.gpg

The PR above also cover this case, as it makes the test only check for the presence of the PPA key fingerprint.

summary: - pytests: tests using apt-key fail on Xenial
+ pytests: TestApt tests parsing the apt-key output fail on Xenial and
+ Hirsute
Changed in cloud-init:
status: New → Fix Committed
Revision history for this message
James Falcon (falcojr) wrote : Fixed in cloud-init version 21.2.

This bug is believed to be fixed in cloud-init in version 21.2. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.