Merge pull request #80785 from oomichi/add-expectequal-hack

Add code check for framework.ExpectEqual()
This commit is contained in:
Kubernetes Prow Robot 2019-08-13 14:16:19 -07:00 committed by GitHub
commit d2eecfe2ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,15 @@ do
fi
done
errors_expect_equal=()
for file in "${all_e2e_files[@]}"
do
if grep -E "Expect\(.*\)\.To\((gomega\.Equal|Equal)" "${file}" > /dev/null
then
errors_expect_equal+=( "${file}" )
fi
done
if [ ${#errors_expect_no_error[@]} -ne 0 ]; then
{
echo "Errors:"
@ -70,4 +79,18 @@ if [ ${#errors_expect_error[@]} -ne 0 ]; then
exit 1
fi
if [ ${#errors_expect_equal[@]} -ne 0 ]; then
{
echo "Errors:"
for err in "${errors_expect_equal[@]}"; do
echo "$err"
done
echo
echo 'The above files need to use framework.ExpectEqual(foo, bar) instead of '
echo 'Expect(foo).To(Equal(bar)) or gomega.Expect(foo).To(gomega.Equal(bar))'
echo
} >&2
exit 1
fi
echo 'Congratulations! All e2e test source files are valid.'