diff --git a/hack/verify-test-code.sh b/hack/verify-test-code.sh index 2590eee9b8c..9e79b76360b 100755 --- a/hack/verify-test-code.sh +++ b/hack/verify-test-code.sh @@ -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.'