Merge ppa-dev-tools:fix-lp2038651-bionic-not-included into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Merged
Merged at revision: 3ce7aaf4b8b5a457ca4b228a7758a1b2ec4216c7
Proposed branch: ppa-dev-tools:fix-lp2038651-bionic-not-included
Merge into: ppa-dev-tools:main
Diff against target: 84 lines (+38/-3)
2 files modified
scripts/ppa (+1/-0)
tests/test_scripts_ppa.py (+37/-3)
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Approve
Andreas Hasenack (community) Approve
PpaDevTools Developers Pending
Canonical Server Reporter Pending
Review via email: mp+453478@code.launchpad.net

Description of the change

Simple fix for issue discovered and reported by Sebastien Bacher, that the trigger list misses packages targeting ESM releases.

I included with this change an expansion of the relevant test case to cover this issue. Running 'make check' without the fix applied will result in a test failure, and with it applied it then passes.

Admittedly, the test case has some bitrot potential in that eventually even ESM releases will become EOL, so eventually this test case will start failing when 'bionic' hits that point. But this isn't the only test case with such an issue. (Eventually these will need fixed by mocking distro-info to allow hardcoding the releases, however that's a larger scope cleanup than this bugfix.)

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

supported_esm() currently also includes trusty and xenial. Should we test for those as well, or are you worried about the test becoming wrong once those become unsupported via esm?

Revision history for this message
Bryce Harrington (bryce) wrote :

> supported_esm() currently also includes trusty and xenial. Should we test for
> those as well, or are you worried about the test becoming wrong once those
> become unsupported via esm?

Exactly, this is destined to bitrot but by ignoring those two I'm hoping to put that day off a few years. :-)

For purposes of the code, checking just one of them is going to be sufficient, and bionic will be around the longest of the three.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, +1

review: Approve
Revision history for this message
Sebastien Bacher (seb128) wrote :

seems also fine to me thanks!

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, landed:

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To git+ssh://git.launchpad.net/ppa-dev-tools
   a2a04a8..3ce7aaf main -> main

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/scripts/ppa b/scripts/ppa
index f252363..16a7456 100755
--- a/scripts/ppa
+++ b/scripts/ppa
@@ -940,6 +940,7 @@ def command_tests(lp: Lp, config: dict[str, str]) -> int:
940 if releases is None:940 if releases is None:
941 udi = UbuntuDistroInfo()941 udi = UbuntuDistroInfo()
942 releases = udi.supported()942 releases = udi.supported()
943 releases.extend(r for r in udi.supported_esm() if r not in releases)
943 if isinstance(releases, str):944 if isinstance(releases, str):
944 releases = list(unpack_to_dict(releases).keys())945 releases = list(unpack_to_dict(releases).keys())
945 if not isinstance(releases, list):946 if not isinstance(releases, list):
diff --git a/tests/test_scripts_ppa.py b/tests/test_scripts_ppa.py
index 4052172..07a1b32 100644
--- a/tests/test_scripts_ppa.py
+++ b/tests/test_scripts_ppa.py
@@ -742,22 +742,55 @@ def test_command_show(fake_config):
742 assert script.command_show(lp, fake_config) == 0742 assert script.command_show(lp, fake_config) == 0
743743
744744
745@pytest.mark.parametrize('params, format, expected_in_stdout', [745@pytest.mark.parametrize('params, pubs, format, expected_in_stdout', [
746 (746 (
747 # General behavior
747 {748 {
748 'releases': None,749 'releases': None,
749 'architectures': 'amd64',750 'architectures': 'amd64',
750 'show_urls': True751 'show_urls': True
751 },752 },
753 [('x', '1', 'Published', 'jammy')],
752 'plain',754 'plain',
753 'arch=amd64&trigger=x%2F1&ppa=me%2Ftesting'755 'arch=amd64&trigger=x%2F1&ppa=me%2Ftesting'
754 ),756 ),
757 (
758 # Specified release
759 {
760 'releases': 'focal',
761 'architectures': 'amd64',
762 'show_urls': True
763 },
764 [
765 ('x', '3.2.1', 'Published', 'jammy'),
766 ('x', '1.2.3', 'Published', 'focal'),
767 ('x', '1.0.0', 'Published', 'bionic'),
768 ],
769 'plain',
770 'arch=amd64&trigger=x%2F1.2.3&ppa=me%2Ftesting'
771 ),
772 (
773 # Default behavior should include ESM releases (LP: #2038651)
774 {
775 'releases': None,
776 'architectures': 'amd64',
777 'show_urls': True
778 },
779 [
780 ('x', '3.2.1', 'Published', 'jammy'),
781 ('x', '1.2.3', 'Published', 'focal'),
782 ('x', '1.0.0', 'Published', 'bionic'),
783 ],
784 'plain',
785 'arch=amd64&trigger=x%2F1.0.0&ppa=me%2Ftesting'
786 ),
755])787])
756@patch('urllib.request.urlopen')788@patch('urllib.request.urlopen')
757@patch('ppa.io.open_url')789@patch('ppa.io.open_url')
758def test_command_tests(urlopen_mock,790def test_command_tests(urlopen_mock,
759 open_url_mock,791 open_url_mock,
760 fake_config, capfd, params, format, expected_in_stdout):792 fake_config, capfd,
793 params, pubs, format, expected_in_stdout):
761 '''Checks that the tests command retrieves and displays correct results.'''794 '''Checks that the tests command retrieves and displays correct results.'''
762 lp = LpServiceMock()795 lp = LpServiceMock()
763 urlopen_mock.return_value = "{}"796 urlopen_mock.return_value = "{}"
@@ -770,7 +803,8 @@ def test_command_tests(urlopen_mock,
770 the_ppa = lp.me.getPPAByName(fake_config['ppa_name'])803 the_ppa = lp.me.getPPAByName(fake_config['ppa_name'])
771804
772 # Add some fake publications805 # Add some fake publications
773 the_ppa.published_sources.append(PublicationMock('x', '1', 'Published', 'jammy'))806 for pub in pubs:
807 the_ppa.published_sources.append(PublicationMock(*pub))
774808
775 config = {**fake_config, **params}809 config = {**fake_config, **params}
776 assert script.command_tests(lp, config) == 0810 assert script.command_tests(lp, config) == 0

Subscribers

People subscribed via source and target branches

to all changes: