From b283bc13272c1603cb50ac5330f55486f43ab190 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 9 Feb 2023 16:45:31 -0800 Subject: Re-enqueue changes if dequeued missing deps When users create dependency cycles, the process often takes multiple steps, some of which cause changes enqueued in earlier steps to be dequeued. Users then need to re-enqueue those changes in order to have all changes in the cycle tested. This change attempts to improve this by detecting that situation and re-enqueing changes that are being de-queued because of missing deps. Note, thare are plenty of cases where we de-queue because of missing deps and we don't want to re-enqueue (ie, a one-way dependent change ahead has failed). To restrict this to only the situation we're interested in, we only act if the dependencies are already in the pipeline. A recently updated change in a cycle will have just been added to the pipeline, so this is true in the case we're interested in. A one-way dependent change that failed will have already been removed from the pipeline, and so this will be false in cases in which we are not interested. Change-Id: I84b3b2f8fffd1c946dafa605d1c17a37131558bd --- tests/unit/test_circular_dependencies.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/unit/test_circular_dependencies.py b/tests/unit/test_circular_dependencies.py index f38e55001..a3f9dda33 100644 --- a/tests/unit/test_circular_dependencies.py +++ b/tests/unit/test_circular_dependencies.py @@ -2368,13 +2368,10 @@ class TestGerritCircularDependencies(ZuulTestCase): self.executor_server.release() self.waitUntilSettled() - # A quirk: at the end of this process, the first change in - # Gerrit has a complete run because the process of updating it - # involves a new patchset that is enqueued. Compare to the - # same test in GitHub. self.assertHistory([ dict(name="project-job", result="ABORTED", changes="1,1"), dict(name="project-job", result="ABORTED", changes="1,1 2,1"), + dict(name="project-job", result="SUCCESS", changes="1,2 2,1"), dict(name="project-job", result="SUCCESS", changes="2,1 1,2"), ], ordered=False) @@ -2404,12 +2401,9 @@ class TestGerritCircularDependencies(ZuulTestCase): self.executor_server.release() self.waitUntilSettled() - # A quirk: at the end of this process, the second change in - # Gerrit has a complete run because only at that point is the - # topic complete; the first is aborted once the second is - # uploaded. self.assertHistory([ dict(name="check-job", result="ABORTED", changes="1,1"), + dict(name="check-job", result="SUCCESS", changes="2,1 1,1"), dict(name="check-job", result="SUCCESS", changes="1,1 2,1"), ], ordered=False) @@ -2682,13 +2676,11 @@ class TestGithubCircularDependencies(ZuulTestCase): self.executor_server.release() self.waitUntilSettled() - # A quirk: at the end of this process, the second PR in GitHub - # has a complete run because the process of updating the first - # change is not disruptive to the second. Compare to the same - # test in Gerrit. self.assertHistory([ dict(name="project-job", result="ABORTED", changes=f"{A.number},{A.head_sha}"), dict(name="project-job", result="SUCCESS", changes=f"{A.number},{A.head_sha} {B.number},{B.head_sha}"), + dict(name="project-job", result="SUCCESS", + changes=f"{B.number},{B.head_sha} {A.number},{A.head_sha}"), ], ordered=False) -- cgit v1.2.1