summaryrefslogtreecommitdiff
path: root/zuul/driver/gerrit/gerritsource.py
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2023-04-17 15:51:56 -0700
committerJames E. Blair <jim@acmegating.com>2023-04-17 16:51:50 -0700
commit4e0da6221409d63124b2d8ba257df03209314a3d (patch)
tree6bd7e8abe5b9af0a56f7955df651692230cba2cf /zuul/driver/gerrit/gerritsource.py
parentcaa6f2ba24880cf512027e7ce2e7a19213ae7db2 (diff)
downloadzuul-4e0da6221409d63124b2d8ba257df03209314a3d.tar.gz
Further fix getting topic changes by git needs
The test helper method that handles fake gerrit queries had a bug which would cause the "topic:" queries to return all open changes. When we correct that, we can see, by virtue of a newly raised execption that there was some unexercised code in getChangesByTopic which is now exercised. This change also corrects the exception that is raised when mutating a set while iterating over it. Change-Id: I1874482b2c28fd1082fcd56036afb20333232409
Diffstat (limited to 'zuul/driver/gerrit/gerritsource.py')
-rw-r--r--zuul/driver/gerrit/gerritsource.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/zuul/driver/gerrit/gerritsource.py b/zuul/driver/gerrit/gerritsource.py
index 3bf2b3a14..b0bd3c448 100644
--- a/zuul/driver/gerrit/gerritsource.py
+++ b/zuul/driver/gerrit/gerritsource.py
@@ -164,7 +164,9 @@ class GerritSource(BaseSource):
change = self.connection._getChange(change_key)
changes[change_key] = change
- for change in changes.values():
+ # Convert to list here because the recursive call can mutate
+ # the set.
+ for change in list(changes.values()):
for git_change_ref in change.git_needs_changes:
change_key = ChangeKey.fromReference(git_change_ref)
if change_key in changes: