From ae91e0452fee953bfb5c4273e8ea4d53b0157886 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Wed, 15 Feb 2017 15:21:24 -0800 Subject: [PATCH 1/4] test-integration.sh: Avoid unnecessary etcd cleanup --- hack/make-rules/test-integration.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index e04792acb24..0591f6e4950 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -47,14 +47,20 @@ kube::test::find_integration_test_dirs() { ) } +CLEANUP_REQUIRED= cleanup() { + if [[ -z "${CLEANUP_REQUIRED}" ]]; then + return + fi kube::log::status "Cleaning up etcd" kube::etcd::cleanup + CLEANUP_REQUIRED= kube::log::status "Integration test cleanup complete" } runTests() { kube::log::status "Starting etcd instance" + CLEANUP_REQUIRED=1 kube::etcd::start kube::log::status "Running integration test cases" From c762057a7c21f1e1d71c23b8a110f3922cb7a680 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Wed, 15 Feb 2017 15:23:32 -0800 Subject: [PATCH 2/4] test-integration.sh: Exit after running a test case --- hack/make-rules/test-integration.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index 0591f6e4950..8955f6a3f2f 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -93,6 +93,7 @@ trap cleanup EXIT # If a test case is specified, just run once with v1 API version and exit if [[ -n "${KUBE_TEST_ARGS}" ]]; then runTests v1 + exit 0 fi # Pass arguments that begin with "-" and move them to goflags. From 98f5c362ff11ade66788f47630b9c9b4abacd704 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Thu, 16 Feb 2017 10:53:58 -0800 Subject: [PATCH 3/4] test-federation.sh: Make use of WHAT consistent with make test test-integration.sh was using the first positional arg passed to WHAT to filter the list of integration test packages. This change switches to passing WHAT verbatim to be consistent with how make test works. --- hack/make-rules/test-integration.sh | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index 8955f6a3f2f..cd66e72b303 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -41,7 +41,7 @@ KUBE_TEST_ARGS=${KUBE_TEST_ARGS:-} kube::test::find_integration_test_dirs() { ( cd ${KUBE_ROOT} - find test/integration/${1-} -name '*_test.go' -print0 \ + find test/integration/ -name '*_test.go' -print0 \ | xargs -0n1 dirname | sed "s|^|${KUBE_GO_PACKAGE}/|" \ | LC_ALL=C sort -u ) @@ -67,7 +67,7 @@ runTests() { # TODO: Re-enable race detection when we switch to a thread-safe etcd client # KUBE_RACE="-race" make -C "${KUBE_ROOT}" test \ - WHAT="$(kube::test::find_integration_test_dirs ${2-} | paste -sd' ' -) $(echo ${@:3})" \ + WHAT="${WHAT:-$(kube::test::find_integration_test_dirs | paste -sd' ' -)}" \ KUBE_GOFLAGS="${KUBE_GOFLAGS:-} -tags 'integration no-docker'" \ KUBE_TEST_ARGS="${KUBE_TEST_ARGS:-} ${SHORT:--short=true} --vmodule=garbage*collector*=6 --alsologtostderr=true" \ KUBE_RACE="" \ @@ -96,20 +96,8 @@ if [[ -n "${KUBE_TEST_ARGS}" ]]; then exit 0 fi -# Pass arguments that begin with "-" and move them to goflags. -what_flags=() -for arg in "$@"; do - if [[ "${arg}" == -* ]]; then - what_flags+=("${arg}") - fi -done -if [[ "${#what_flags[@]}" -eq 0 ]]; then - what_flags='' -fi - - # Convert the CSV to an array of API versions to test IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}" for apiVersion in "${apiVersions[@]}"; do - runTests "${apiVersion}" "${1-}" "${what_flags[@]}" + runTests "${apiVersion}" done From bd77aa9ae5bed019a5906c8dd9aba72521a5fe96 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Fri, 17 Feb 2017 08:41:06 -0800 Subject: [PATCH 4/4] hack/test-integration.sh: provide a recommended command and exit --- hack/test-integration.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hack/test-integration.sh b/hack/test-integration.sh index 7e3b3ed8970..57f4eead099 100755 --- a/hack/test-integration.sh +++ b/hack/test-integration.sh @@ -22,17 +22,12 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. -# For help output -ARGHELP="" -if [[ "$#" -gt 0 ]]; then - ARGHELP="WHAT='$@'" -fi - -echo "NOTE: $0 has been replaced by 'make test-integration'" +echo "$0 has been replaced by 'make test-integration'" echo -echo "The equivalent of this invocation is: " -echo " make test-integration ${ARGHELP}" +echo "The following invocation will run all integration tests: " +echo ' make test-integration' echo +echo "The following invocation will run a specific test with the verbose flag set: " +echo ' make test-integration WHAT=./test/integration/pods KUBE_GOFLAGS="-v" KUBE_TEST_ARGS="-run ^TestPodUpdateActiveDeadlineSeconds$"' echo -make --no-print-directory -C "${KUBE_ROOT}" test-integration WHAT="$*" - +exit 1