From b5b0a9cd81f55262acb319c5bbc39ebec172a45b Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 2 Jul 2025 14:30:14 -0400 Subject: [PATCH] [release-1.11] Add conditional release-checking system test Unfortunately on a number of occasions, Skopeo has been released officially with a `-dev` suffix in the version number. Assist in catching this mistake at release time by the addition of a simple conditional test. Note that it must be positively enabled by a magic env. var. before executing the system tests. Original PR: https://github.com/containers/skopeo/pull/2631 Signed-off-by: Chris Evich --- systemtest/001-basic.bats | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/systemtest/001-basic.bats b/systemtest/001-basic.bats index 314052fc..6dfcaae6 100644 --- a/systemtest/001-basic.bats +++ b/systemtest/001-basic.bats @@ -16,4 +16,29 @@ function setup() { expect_output --substring "skopeo version [0-9.]+" } +@test "skopeo release isn't a development version" { + [[ "${RELEASE_TESTING:-false}" == "true" ]] || \ + skip "Release testing may be enabled by setting \$RELEASE_TESTING = 'true'." + + run_skopeo --version + + # expect_output() doesn't support negative matching + if [[ "$output" =~ "dev" ]]; then + # This is a multi-line message, which may in turn contain multi-line + # output, so let's format it ourselves, readably + local -a output_split + readarray -t output_split <<<"$output" + printf "#/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n" >&2 + printf "#| FAIL: $BATS_TEST_NAME\n" >&2 + printf "#| unexpected: 'dev'\n" >&2 + printf "#| actual: '%s'\n" "${output_split[0]}" >&2 + local line + for line in "${output_split[@]:1}"; do + printf "#| > '%s'\n" "$line" >&2 + done + printf "#\\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" >&2 + false + fi +} + # vim: filetype=sh