Skip to content

Commit bb74536

Browse files
committed
test: preserve required CI gate contracts after cancellation fix
1 parent 7164d6b commit bb74536

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎scripts/tests/test_ci_test_shard.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_all_release_shards_are_required_and_use_the_matrix_size(self):
131131
verdict = workflow.split("\n ci-ok:\n")[1]
132132
needs = re.search(r"^ needs: \[(.*)\]$", verdict, re.M)[1].split(", ")
133133
self.assertIn("test-release", needs)
134-
self.assertIn("if: always()", verdict)
134+
self.assertIn("if: ${{ always() && (github.event_name != 'pull_request' || !cancelled()) }}", verdict)
135135
self.assertIn('if v["result"] not in ("success", "skipped")', verdict)
136136

137137

‎scripts/tests/test_merge_queue_fail_fast.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def test_no_job_tolerates_failure(self):
4747
# job, and this script would then cancel a run that could still land.
4848
self.assertIsNone(re.search(r"^\s*continue-on-error:", self.text, re.M))
4949

50-
def test_gate_runs_on_a_cancelled_run(self):
50+
def test_gate_runs_on_a_cancelled_merge_group_run(self):
5151
gate = self.text[self.text.index("\n ci-ok:"):]
52-
self.assertRegex(gate, r"\n if: always\(\)\n")
52+
# Only PR cancellations can skip the verdict. The merge-queue
53+
# watcher must still turn failed/cancelled dependencies into failure.
54+
self.assertIn("\n if: ${{ always() && (github.event_name != 'pull_request' || !cancelled()) }}\n", gate)
5355

5456

5557
if __name__ == "__main__":

0 commit comments

Comments
 (0)