Merge pull request #10702 from owncloud/fix-check-deleted-suites

[tests-only][full-ci] fix check for deleted suites in expected failure file
This commit is contained in:
Prajwol Amatya
2024-12-05 09:03:19 +05:45
committed by GitHub

View File

@@ -18,7 +18,7 @@ log_success() {
SCRIPT_PATH=$(dirname "$0")
PATH_TO_SUITES="${SCRIPT_PATH}/features"
EXPECTED_FAILURE_FILES=("expected-failures-localAPI-on-OCIS-storage.md" "expected-failures-API-on-OCIS-storage.md")
EXPECTED_FAILURE_FILES=("expected-failures-localAPI-on-OCIS-storage.md" "expected-failures-API-on-OCIS-storage.md" "expected-failures-without-remotephp.md")
# contains all the suites names inside tests/acceptance/features
AVAILABLE_SUITES=($(ls -l "$PATH_TO_SUITES" | grep '^d' | awk '{print $NF}'))
@@ -42,20 +42,29 @@ for expected_failure_file in "${EXPECTED_FAILURE_FILES[@]}"; do
# also filter the duplicated suites name
EXPECTED_FAILURE_SUITES=($(echo "${EXPECTED_FAILURE_SUITES[@]}" | tr ' ' '\n' | sort | uniq))
# Check the existence of the suite
NONEXISTING_SCENARIOS=()
NON_EXISTING_SCENARIOS=()
FEATURE_PATTERN="[a-zA-Z0-9]+\\.feature:[0-9]+"
for suite in "${EXPECTED_FAILURE_SUITES[@]}"; do
pattern="(\\b${suite}/${FEATURE_PATTERN}\\b)"
if [[ " ${AVAILABLE_SUITES[*]} " != *" $suite "* ]]; then
pattern="(${suite}/[a-zA-Z0-9]+\\.feature:[0-9]+)"
NONEXISTING_SCENARIOS+=($(grep -Eo ${pattern} ${PATH_TO_EXPECTED_FAILURE_FILE}))
NON_EXISTING_SCENARIOS+=($(grep -Eo ${pattern} ${PATH_TO_EXPECTED_FAILURE_FILE}))
else
SCENARIOS=($(grep -Eo ${pattern} ${PATH_TO_EXPECTED_FAILURE_FILE} | grep -Eo "${FEATURE_PATTERN}"))
for scenario in "${SCENARIOS[@]}"; do
FEATURE_FILE=$(echo "$scenario" | cut -d':' -f1)
if [[ ! -f "$PATH_TO_SUITES/$suite/$FEATURE_FILE" ]]; then
NON_EXISTING_SCENARIOS+=("$suite/$scenario")
fi
done
fi
done
count="${#NONEXISTING_SCENARIOS[@]}"
count="${#NON_EXISTING_SCENARIOS[@]}"
if [ "$count" -gt 0 ]; then
EXIT_CODE=1
log_info "The following test scenarios do not exist anymore:"
log_info "They can be deleted from the '${expected_failure_file}'"
for scenario_path in "${NONEXISTING_SCENARIOS[@]}"; do
for scenario_path in "${NON_EXISTING_SCENARIOS[@]}"; do
log_error "$scenario_path"
done
else