summaryrefslogtreecommitdiff
path: root/tests/base.py
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2022-07-21 14:05:57 -0700
committerJames E. Blair <jim@acmegating.com>2022-07-25 13:22:19 -0700
commita9a9d32b210f3fa7dee8d12bbd2748e152207ea6 (patch)
tree47f1f3be72c0e20374f085584f91b4556bdbf5e9 /tests/base.py
parent4a4a33720b1bca9f454e6f29d89c0865548503d7 (diff)
downloadzuul-a9a9d32b210f3fa7dee8d12bbd2748e152207ea6.tar.gz
Fix duplicate setResult calls in deduplicated builds
We call item.setResult after a build is complete so that the queue item can do any internal processing necessary (for example, prepare data structures for child jobs, or move the build to the retry_builds list). In the case of deduplicated builds, we should do that for every queue item the build participates in since each item may have a different job graph. We were not correctly identifying other builds of deduplicated jobs and so in the case of a dependency cycle we would call setResult on jobs of the same name in that cycle regardless of whether they were deduplicated. This corrects the issue and adds a test to detect that case. Change-Id: I4c47beb2709a77c21c11c97f1d1a8f743d4bf5eb
Diffstat (limited to 'tests/base.py')
-rw-r--r--tests/base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/base.py b/tests/base.py
index 5a85ea0d7..1ea699a51 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -3091,6 +3091,8 @@ class FakeBuild(object):
self.paused = False
self.aborted = False
self.requeue = False
+ self.should_fail = False
+ self.should_retry = False
self.created = time.time()
self.changes = None
items = self.parameters['zuul']['items']
@@ -3162,6 +3164,8 @@ class FakeBuild(object):
return result
def shouldFail(self):
+ if self.should_fail:
+ return True
changes = self.executor_server.fail_tests.get(self.name, [])
for change in changes:
if self.hasChanges(change):
@@ -3169,6 +3173,8 @@ class FakeBuild(object):
return False
def shouldRetry(self):
+ if self.should_retry:
+ return True
entries = self.executor_server.retry_tests.get(self.name, [])
for entry in entries:
if self.hasChanges(entry['change']):