cri-o/hack/validate/deprecate-crioctl
Antonio Murdaca 8ae0aee7e5
hack: validate tests for crioctl deprecation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-13 16:55:45 +01:00

31 lines
754 B
Bash
Executable file

#!/usr/bin/env bash
# Check that no new tests are being added using crioctl
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPTDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'test/*.bats' || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed doesn't contain crioctl calls
if git show "$VALIDATE_HEAD:$f" | grep -q crioctl; then
badFiles+=( "$f" )
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! No new tests have been added using crioctl.'
else
{
echo "These files use crioctl instead of crictl:"
echo ""
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
} >&2
false
fi