From e120f11438e4796571797f81d8fc44b01826ea99 Mon Sep 17 00:00:00 2001 From: brianpursley Date: Wed, 2 Feb 2022 21:51:15 -0500 Subject: [PATCH] Change legacy-script.sh to produce junit output in location set by the ARTIFACTS environment variables if KUBE_JUNIT_REPORT_DIR is not set. Add missing record_command to a couple of tests in legacy-script.sh. Fix some typos in /test/cmd/README.md --- test/cmd/README.md | 4 ++-- test/cmd/legacy-script.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/cmd/README.md b/test/cmd/README.md index b0ff75c219c..ea4a1c43e42 100644 --- a/test/cmd/README.md +++ b/test/cmd/README.md @@ -10,12 +10,12 @@ To run this entire suite, execute `make test-cmd` from the top level. This will ### Specific Tests -To run a subset of tests (e.g. `run_deployment_test` and `run_impersonation_test`), execute `make test-cmd WHAT="deployment impersonation"`. Running specific +To run a subset of tests (e.g. `run_deployment_tests` and `run_impersonation_tests`), execute `make test-cmd WHAT="deployment impersonation"`. Running specific tests will not try and validate any required resources are available on the server. ## Adding Tests -Test functions need to have the format `run_*_test` so they can be executed individually. Once a test has been added, insert a section in `legacy-script.sh` like +Test functions need to have the format `run_*_tests` so they can be executed individually. Once a test has been added, insert a section in `legacy-script.sh` like ```bash ###################### diff --git a/test/cmd/legacy-script.sh b/test/cmd/legacy-script.sh index 6ce6d67edf0..fc87945efad 100755 --- a/test/cmd/legacy-script.sh +++ b/test/cmd/legacy-script.sh @@ -106,6 +106,11 @@ daemonsets="daemonsets" controllerrevisions="controllerrevisions" job="jobs" +# A junit-style XML test report will be generated in the directory specified by KUBE_JUNIT_REPORT_DIR, if set. +# If KUBE_JUNIT_REPORT_DIR is unset, and ARTIFACTS is set, then use what is set in ARTIFACTS. +if [[ -z "${KUBE_JUNIT_REPORT_DIR:-}" && -n "${ARTIFACTS:-}" ]]; then + export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}" +fi # include shell2junit library sh2ju="${KUBE_ROOT}/third_party/forked/shell2junit/sh2ju.sh" @@ -606,7 +611,7 @@ runTests() { ##################################### if kube::test::if_supports_resource "${pods}" ; then - run_recursive_resources_tests + record_command run_recursive_resources_tests fi @@ -922,7 +927,7 @@ runTests() { ############################ if kube::test::if_supports_resource "${podsecuritypolicies}" ; then - run_deprecated_api_tests + record_command run_deprecated_api_tests fi