Merge pull request #92148 from oomichi/block-tests-in-e2e-framework

Add check for blocking tests in e2e framework
This commit is contained in:
Kubernetes Prow Robot 2020-06-24 13:31:07 -07:00 committed by GitHub
commit 3fbe8c09ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,17 @@ do
fi
done
all_e2e_framework_files=()
kube::util::read-array all_e2e_framework_files < <(find test/e2e/framework/ -name '*.go' | grep -v "_test.go")
errors_framework_contains_tests=()
for file in "${all_e2e_framework_files[@]}"
do
if grep -E "(ConformanceIt\(.*, func\(\) {|ginkgo.It\(.*, func\(\) {)" "${file}" > /dev/null
then
errors_framework_contains_tests+=( "${file}" )
fi
done
if [ ${#errors_expect_no_error[@]} -ne 0 ]; then
{
echo "Errors:"
@ -120,4 +131,18 @@ if [ ${#errors_expect_equal[@]} -ne 0 ]; then
exit 1
fi
if [ ${#errors_framework_contains_tests[@]} -ne 0 ]; then
{
echo "Errors:"
for err in "${errors_framework_contains_tests[@]}"; do
echo "$err"
done
echo
echo 'The above e2e framework files should not contain any e2e tests which are implemented '
echo 'with framework.ConformanceIt() or ginkgo.It()'
echo
} >&2
exit 1
fi
echo 'Congratulations! All e2e test source files are valid.'