From b959c560cc972cef81174186d31a665c8cc8edf6 Mon Sep 17 00:00:00 2001 From: Lemon-miaow Date: Sun, 27 Sep 2026 17:17:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E6=B5=8B=E8=AF=95=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=9C=89=E5=A4=B1=E8=B4=A5=E5=B0=B1=20exit=201?= =?UTF-8?q?=EF=BC=8C256=20=E4=B8=AA=E5=A4=B1=E8=B4=A5=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=9B=9E=E7=BB=95=E6=88=90=E9=80=9A=E8=BF=87=EF=BC=9B=E9=9D=9E?= =?UTF-8?q?=20registry=20=E9=95=9C=E5=83=8F=E4=B8=8D=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E7=9A=84=E6=96=AD=E8=A8=80=E6=94=B9=E6=8C=89=E5=B8=A6=20--conf?= =?UTF-8?q?ig=20=E7=9A=84=20push=20=E8=A1=8C=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 6 ++++++ deploy/bootstrap_test.sh | 12 ++++++++---- deploy/e2e_check.sh | 2 +- deploy/e2e_release.sh | 2 +- deploy/e2e_release_test.sh | 3 +-- deploy/uninstall_test.sh | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36807a6..f050cf1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,6 +138,12 @@ jobs: tar -xJf shellcheck.tar.xz ./shellcheck-v0.11.0/shellcheck -S warning $(git ls-files '*.sh') + # An exit status is 8 bits, so `exit "$fails"` reads 256 failures as a pass. The suites + # exit 1 on any failure; this keeps the next one from carrying its count out. + - name: No script exits with its failure count + run: | + if git grep -nE 'exit +"?\$\{?[a-z_]*fail[a-z_]*\}?"?[[:space:]]*$' -- '*.sh'; then exit 1; fi + - run: sh deploy/bootstrap_test.sh - run: sh deploy/uninstall_test.sh - run: bash deploy/e2e_release_test.sh diff --git a/deploy/bootstrap_test.sh b/deploy/bootstrap_test.sh index 5b2466e..ee9f9c2 100644 --- a/deploy/bootstrap_test.sh +++ b/deploy/bootstrap_test.sh @@ -1414,9 +1414,13 @@ expect "and pushed to exactly that endpoint, with the platform login" "DOCKER -- out="$(run_push registry.felis.svc:50000/felis/felis:demo)" expect "a ref outside the registry is refused with a warning" "WARN: not mirroring" "$out" -case "$out" in - *"DOCKER push"*) echo "FAIL: a non-registry ref must not be pushed"; fails=$((fails + 1)) ;; -esac +# The push runs with the platform login, `docker --config push`, so any docker line +# with a push in it counts. +if printf '%s\n' "$out" | grep -q '^DOCKER .*push '; then + echo "FAIL a ref outside the registry was pushed: $out"; fails=$((fails + 1)) +else + echo "PASS a ref outside the registry is not pushed" +fi out="$(run_push registry.felis.svc:5000/felis/felis:demo 1)" expect "a failed push fails the install loudly" "DIE: could not mirror" "$out" @@ -4605,5 +4609,5 @@ if [ "$fails" -eq 0 ]; then echo "ALL PASS" else echo "$fails FAILED" + exit 1 fi -exit "$fails" diff --git a/deploy/e2e_check.sh b/deploy/e2e_check.sh index 6af2e0a..0af309a 100644 --- a/deploy/e2e_check.sh +++ b/deploy/e2e_check.sh @@ -240,5 +240,5 @@ if [ "$fails" -eq 0 ]; then echo "ALL PASS (${phase})" else echo "${fails} FAILED (${phase})" + exit 1 fi -exit "$fails" diff --git a/deploy/e2e_release.sh b/deploy/e2e_release.sh index b9f21f0..e47e46c 100644 --- a/deploy/e2e_release.sh +++ b/deploy/e2e_release.sh @@ -109,4 +109,4 @@ case "${1:-}" in exit 2 ;; esac -exit "$fails" +[ "$fails" -eq 0 ] || exit 1 diff --git a/deploy/e2e_release_test.sh b/deploy/e2e_release_test.sh index fdc48b2..dcc13e1 100644 --- a/deploy/e2e_release_test.sh +++ b/deploy/e2e_release_test.sh @@ -184,5 +184,4 @@ same " and says so" "::error::gh release view answered without a tag" "$out" same " and writes no outputs" "" "$(cat "$root/out")" echo -if [ "$fails" -eq 0 ]; then echo "ALL PASS"; else echo "${fails} FAILED"; fi -exit "$fails" +if [ "$fails" -eq 0 ]; then echo "ALL PASS"; else echo "${fails} FAILED"; exit 1; fi diff --git a/deploy/uninstall_test.sh b/deploy/uninstall_test.sh index b155565..0117630 100644 --- a/deploy/uninstall_test.sh +++ b/deploy/uninstall_test.sh @@ -387,5 +387,5 @@ if [ "$fails" -eq 0 ]; then echo "ALL PASS" else echo "$fails FAILED" + exit 1 fi -exit "$fails"