Merge ppa-dev-tools:fix-command-tests-with-releases into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Merged
Merged at revision: 06e615249c16abc78a23cf448e72405120384f2f
Proposed branch: ppa-dev-tools:fix-command-tests-with-releases
Merge into: ppa-dev-tools:main
Diff against target: 64 lines (+15/-4)
2 files modified
ppa/ppa.py (+3/-3)
scripts/ppa (+12/-1)
Reviewer Review Type Date Requested Status
Andreas Hasenack (community) Approve
PpaDevTools Developers Pending
Canonical Server Pending
Canonical Server Reporter Pending
Review via email: mp+451225@code.launchpad.net

Description of the change

Fix for issue Andreas raised today, that running ppa tests --releases jammy produces no results when it should.

The fix for this is straightforward, and I noticed the same pattern a couple other places and fix them up as well.

There are actually several other bugs reported with related issues around test output filtering. I thought of including fixes for those as well, however they involve some additional plumbing work (and associated unit tests) and a fair bit of refactoring, so am going to leave that work for later, to keep this branch focused more on bug fixing. The refactoring of command_tests() has been an ongoing project, and those fixes will come as that work gets completed.

I'd really like to include some unit test updates with this branch, however test_command_tests() only deals with triggers so far. I started looking at expanding that to also include results, however I think it will be better to work on tests once the aforementioned refactoring is done.

For testing this fix, I ran the command in various ways against different people's PPAs. The commit messages make mention of some of the more interesting ones I tested against.

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

+1

Initially I thought unpack_to_dict() was quite a convoluted way to make a comma-separated string a list, but it's a function used in many places and it has tests.

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

Thanks for the review Andreas, branch landed:

$ git merge --ff-only fix-command-tests-with-releases
Updating 6c63268..06e6152
Fast-forward
 ppa/ppa.py | 6 +++---
 scripts/ppa | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)
$ git push origin
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To git+ssh://git.launchpad.net/ppa-dev-tools
   6c63268..06e6152 main -> main

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/ppa/ppa.py b/ppa/ppa.py
index 57ec14b..23ea58a 100755
--- a/ppa/ppa.py
+++ b/ppa/ppa.py
@@ -528,7 +528,7 @@ class Ppa:
528 print("Successfully published all builds for all architectures")528 print("Successfully published all builds for all architectures")
529 return retval529 return retval
530530
531 def get_autopkgtest_waiting(self, releases):531 def get_autopkgtest_waiting(self, releases: list[str]):
532 """Return iterator of queued autopkgtests for this PPA.532 """Return iterator of queued autopkgtests for this PPA.
533533
534 See get_waiting() for details534 See get_waiting() for details
@@ -542,7 +542,7 @@ class Ppa:
542 return get_waiting(response, releases=releases, ppa=str(self))542 return get_waiting(response, releases=releases, ppa=str(self))
543 return []543 return []
544544
545 def get_autopkgtest_running(self, releases):545 def get_autopkgtest_running(self, releases: list[str]):
546 """Return iterator of queued autopkgtests for this PPA.546 """Return iterator of queued autopkgtests for this PPA.
547547
548 See get_running() for details548 See get_running() for details
@@ -556,7 +556,7 @@ class Ppa:
556 return get_running(response, releases=releases, ppa=str(self))556 return get_running(response, releases=releases, ppa=str(self))
557 return []557 return []
558558
559 def get_autopkgtest_results(self, releases, architectures):559 def get_autopkgtest_results(self, releases: list[str], architectures: list[str]):
560 """Returns iterator of results from autopkgtest runs for this PPA.560 """Returns iterator of results from autopkgtest runs for this PPA.
561561
562 See get_results() for details562 See get_results() for details
diff --git a/scripts/ppa b/scripts/ppa
index 9dbb15a..edf82b7 100755
--- a/scripts/ppa
+++ b/scripts/ppa
@@ -849,8 +849,17 @@ def command_tests(lp: Lp, config: dict[str, str]) -> int:
849 if releases is None:849 if releases is None:
850 udi = UbuntuDistroInfo()850 udi = UbuntuDistroInfo()
851 releases = udi.supported()851 releases = udi.supported()
852 if isinstance(releases, str):
853 releases = list(unpack_to_dict(releases).keys())
854 if not isinstance(releases, list):
855 raise TypeError(f"Parameter releases={releases} not of type list")
852856
853 packages = config.get('packages', None)857 packages = config.get('packages', None)
858 if not packages is None:
859 if isinstance(packages, str):
860 packages = list(unpack_to_dict(packages).keys())
861 if not isinstance(packages, list):
862 raise TypeError(f"Parameter packages={packages} not of type list")
854863
855 the_ppa = get_ppa(lp, config)864 the_ppa = get_ppa(lp, config)
856 if not the_ppa.exists():865 if not the_ppa.exists():
@@ -859,7 +868,9 @@ def command_tests(lp: Lp, config: dict[str, str]) -> int:
859868
860 architectures = config.get('architectures', ARCHES_AUTOPKGTEST)869 architectures = config.get('architectures', ARCHES_AUTOPKGTEST)
861 if isinstance(architectures, str):870 if isinstance(architectures, str):
862 architectures = unpack_to_dict(architectures).keys()871 architectures = list(unpack_to_dict(architectures).keys())
872 if not isinstance(architectures, list):
873 raise TypeError(f"Parameter architectures={architectures} not of type list")
863874
864 try:875 try:
865 # Triggers876 # Triggers

Subscribers

People subscribed via source and target branches

to all changes: