mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Add code check for framework.ExpectEqual()
This adds code check for using framework.ExpectEqual(foo, bar) in e2e tests for keeping the test code simple.
This commit is contained in:
parent
bdde11a664
commit
ad988085f6
@ -42,6 +42,15 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
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
|
if [ ${#errors_expect_no_error[@]} -ne 0 ]; then
|
||||||
{
|
{
|
||||||
echo "Errors:"
|
echo "Errors:"
|
||||||
@ -70,4 +79,18 @@ if [ ${#errors_expect_error[@]} -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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.'
|
echo 'Congratulations! All e2e test source files are valid.'
|
||||||
|
Loading…
Reference in New Issue
Block a user