Merge pull request #9305 from BbolroC/handle-comment-for-skipped-tests

CI|k8s: Handle skipped tests with a comment for filter_out_per_arch
This commit is contained in:
Hyounggyu Choi
2024-03-19 22:54:03 +01:00
committed by GitHub

View File

@@ -35,7 +35,19 @@ main()
local flag="false"
for SKIP_ENTRY in "${_K8S_SKIP_UNION[@]}"
do
SKIP_ENTRY="${SKIP_ENTRY#- }.bats"
# Remove '- ' from the beginning of the string
# Example: "- test.bats" -> "test.bats"
SKIP_ENTRY="${SKIP_ENTRY#- }"
# Remove a comment if it exists
# Example: "test.bats # comment" -> "test.bats "
SKIP_ENTRY="${SKIP_ENTRY%#*}"
# Strip trailing spaces if it exists
# Example: "test.bats " -> "test.bats"
# Explanation for parameter expansion:
# A="${SKIP_ENTRY##*[![:space:]]}" - get spaces after the last non-space character
# SKIP_ENTRY="${SKIP_ENTRY%"${A}"}" - remove the spaces from the string
SKIP_ENTRY="${SKIP_ENTRY%"${SKIP_ENTRY##*[![:space:]]}"}"
SKIP_ENTRY="${SKIP_ENTRY}.bats"
[ "$SKIP_ENTRY" == "$TEST_ENTRY" ] && flag="true"
done
[ "$flag" == "false" ] && result+=("$TEST_ENTRY")