action #62741
closed
coordination #56477: Implement notifications in case specific files were changed in PR
[functional][y] Check if renamed/deleted modules are not mentioned in any of schedules
Added by riafarov almost 5 years ago.
Updated over 3 years ago.
Description
Motivation¶
yaml schedules are error prone as we deal with many files and modules. So we continue improving our automated checks to catch these.
Next step will be to check that if we rename module or remove it, that it's not mentioned in any of the yaml schedules and not in main.pm/main_common.pm files
Acceptance criteria¶
- CI reports clear error if renamed/removed test module is referenced in any yaml schedule or with loadtest calls in main.pm files or main_common.pm
Suggestion¶
sh is preferable over bash as it's more scalable.
I've created the scripts using bash, but in order to be consistent we should use sh here (as we are using it in all other CI scripts and it is compatible with more systems). Maybe it will be useful for the one who will pick up the ticket:
Detect deleted files:
#! /bin/bash
# Add all changed files under 'test/' folder to the array in the format how they are used in scheduling files (excluding 'tests/' and file extension).
readarray -t deleted_modules < <(git diff origin/master $TRAVIS_BRANCH --name-only --diff-filter=D --exit-code | cut -f 2- -d '/' | cut -f 1 -d '.')
for module in "${deleted_modules[@]}"
do
if matched_scheduling_files="$(grep --recursive --ignore-case --files-with-matches $module schedule/)"
then
printf "\"$module\" test module was removed, but it is still used in the following YAML schedule files:\n$matched_scheduling_files\n"
exit 1
fi
done
Detect renamed files:
#! /bin/bash
# Add all changed files under 'test/' folder to the array in the format how they are used in scheduling files (excluding 'tests/' and file extension).
readarray -t renamed_modules < <(git diff origin/master $TRAVIS_BRANCH --diff-filter=R --exit-code | grep 'rename from' | cut -f 2- -d '/' | cut -f 1 -d '.')
for module in "${renamed_modules[@]}"
do
if matched_scheduling_files="$(grep --recursive --ignore-case --files-with-matches $module schedule/)"
then
printf "\"$module\" test module was renamed, but it was not modified in the following YAML schedule files:\n$matched_scheduling_files\n"
fi
done
- Description updated (diff)
- Status changed from New to Workable
- Estimated time set to 5.00 h
- Assignee deleted (
JRivrain)
- Assignee set to JERiveraMoya
- Status changed from Workable to Feedback
- Status changed from Feedback to Resolved
- Due date deleted (
2020-02-11)
Also available in: Atom
PDF