Skip to content

Commit 6a0af3b

Browse files
fix(tests): update the promote gate contract for the renamed label
promote-gate-contract.bats pins the exact text of `plan`'s guard and of the label terms in e2e-fork.yaml and promote-rc.yaml. Renaming full-e2e to e2e/full moved all of them, and `plan`'s guard changed shape as well when the expensive lane moved off `synchronize`: it now carries a review clause and a second label name. Caught by CI rather than locally, because the contract test ran before the rename in this branch and was not run again after it. The whole `make unit-tests` gate is the correct thing to run before a push, not the files the change appears to touch. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 7b98b59 commit 6a0af3b

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎hack/promote-gate-contract.bats‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ code_lines() {
9494
[ "${count:-0}" -eq 1 ]
9595
}
9696

97-
@test "promote PR keeps release label and does not auto-apply full-e2e" {
97+
@test "promote PR keeps release label and does not auto-apply e2e/full" {
9898
block="$(job_block open-pr "$PROMOTE")"
9999
[ -n "$block" ]
100100

101101
count="$(printf '%s\n' "$block" | code_lines | grep -cF -- '--body "$BODY" --label release' || true)"
102102
[ "${count:-0}" -eq 1 ]
103103

104-
count="$(printf '%s\n' "$block" | code_lines | grep -cF -- '--label full-e2e' || true)"
104+
count="$(printf '%s\n' "$block" | code_lines | grep -cF -- '--label e2e/full' || true)"
105105
[ "${count:-0}" -eq 0 ]
106106
}
107107

@@ -125,22 +125,26 @@ code_lines() {
125125
[ "${count:-0}" -eq 1 ]
126126
}
127127

128-
@test "release PR E2E is a working manual full-e2e label opt-in" {
128+
@test "release PR E2E is a working manual e2e/full label opt-in" {
129129
count="$(code_lines < "$PULL_REQUESTS" | grep -cF ' types: [opened, synchronize, reopened, labeled]' || true)"
130130
[ "${count:-0}" -eq 1 ]
131131

132132
plan_header="$(job_header plan "$PULL_REQUESTS")"
133-
count="$(printf '%s\n' "$plan_header" | code_lines | grep -cF " if: github.event.action != 'labeled' || github.event.label.name == 'full-e2e'" || true)"
133+
# `plan`'s guard gained a review clause and a second label when the expensive
134+
# lane moved off `synchronize`, so the pin is the whole line rather than the
135+
# label term alone. Both label names must appear: e2e/full is the scope opt-in
136+
# this test is about, e2e/run is the "run it now" button beside it.
137+
count="$(printf '%s\n' "$plan_header" | code_lines | grep -cF " if: (github.event_name != 'pull_request_review' || github.event.review.state == 'approved') && (github.event.action != 'labeled' || github.event.label.name == 'e2e/full' || github.event.label.name == 'e2e/run' || (github.event.label.name == 'release' && !github.event.pull_request.head.repo.fork))" || true)"
134138
[ "${count:-0}" -eq 1 ]
135139

136140
resolve_header="$(job_header resolve_assets "$PULL_REQUESTS")"
137-
count="$(printf '%s\n' "$resolve_header" | code_lines | grep -cF "github.event.label.name == 'full-e2e'" || true)"
141+
count="$(printf '%s\n' "$resolve_header" | code_lines | grep -cF "github.event.label.name == 'e2e/full'" || true)"
138142
[ "${count:-0}" -eq 1 ]
139143

140144
e2e_header="$(job_header e2e "$PULL_REQUESTS")"
141145
count="$(printf '%s\n' "$e2e_header" | code_lines | grep -cF "needs.resolve_assets.result == 'success'" || true)"
142146
[ "${count:-0}" -eq 1 ]
143-
count="$(printf '%s\n' "$e2e_header" | code_lines | grep -cF "&& contains(github.event.pull_request.labels.*.name, 'full-e2e')" || true)"
147+
count="$(printf '%s\n' "$e2e_header" | code_lines | grep -cF "&& contains(github.event.pull_request.labels.*.name, 'e2e/full')" || true)"
144148
[ "${count:-0}" -eq 1 ]
145149
}
146150

0 commit comments

Comments
 (0)