diff --git a/hack/jenkins/test-dockerized.sh b/hack/jenkins/test-dockerized.sh index 69a9852dacd..b2e84778e87 100755 --- a/hack/jenkins/test-dockerized.sh +++ b/hack/jenkins/test-dockerized.sh @@ -19,17 +19,6 @@ set -o nounset set -o pipefail set -o xtrace -retry() { - for i in {1..5}; do - if "$@"; then - return 0 - else - sleep "${i}" - fi - done - "$@" -} - # Runs the unit and integration tests, producing JUnit-style XML test # reports in ${WORKSPACE}/artifacts. This script is intended to be run from # kubekins-test container with a kubernetes repo mapped in. See @@ -47,14 +36,10 @@ pushd "./hack/tools" >/dev/null GO111MODULE=on go install gotest.tools/gotestsum popd >/dev/null -# Enable the Go race detector. -export KUBE_RACE=-race # Disable coverage report export KUBE_COVER="n" # Set artifacts directory export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"} -# Produce a JUnit-style XML test report -export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}" # Save the verbose stdout as well. export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y export KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4 diff --git a/hack/make-rules/test-cmd.sh b/hack/make-rules/test-cmd.sh index 52b7a3f4893..f6edd1dee92 100755 --- a/hack/make-rules/test-cmd.sh +++ b/hack/make-rules/test-cmd.sh @@ -170,7 +170,8 @@ if [[ ${WHAT} == "" || ${WHAT} =~ .*kubeadm.* ]] ; then # invoke the tests make -C "${KUBE_ROOT}" test \ WHAT=k8s.io/kubernetes/cmd/kubeadm/test/cmd \ - KUBE_TIMEOUT=--timeout=240s + KUBE_TIMEOUT=--timeout=240s \ + KUBE_RACE="" # if we ONLY want to run kubeadm, then exit here. if [[ ${WHAT} == "kubeadm" ]]; then diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index 88647f8afd2..9707fefd37d 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -66,16 +66,12 @@ runTests() { kube::etcd::start kube::log::status "Running integration test cases" - # export KUBE_RACE - # - # Enable the Go race detector. - export KUBE_RACE="-race" make -C "${KUBE_ROOT}" test \ WHAT="${WHAT:-$(kube::test::find_integration_test_dirs | paste -sd' ' -)}" \ GOFLAGS="${GOFLAGS:-}" \ KUBE_TEST_ARGS="--alsologtostderr=true ${KUBE_TEST_ARGS:-} ${SHORT:--short=true} --vmodule=${KUBE_TEST_VMODULE}" \ - KUBE_RACE="" \ - KUBE_TIMEOUT="${KUBE_TIMEOUT}" + KUBE_TIMEOUT="${KUBE_TIMEOUT}" \ + KUBE_RACE="" cleanup } diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index 21cd65c4922..3b9e5520cc6 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -71,7 +71,10 @@ KUBE_COVER_REPORT_DIR="${KUBE_COVER_REPORT_DIR:-}" # How many 'go test' instances to run simultaneously when running tests in # coverage mode. KUBE_COVERPROCS=${KUBE_COVERPROCS:-4} -KUBE_RACE=${KUBE_RACE:-} # use KUBE_RACE="-race" to enable race testing +# use KUBE_RACE="" to disable the race detector +# this is defaulted to "-race" in make test as well +# NOTE: DO NOT ADD A COLON HERE. KUBE_RACE="" is meaningful! +KUBE_RACE=${KUBE_RACE-"-race"} # Set to the goveralls binary path to report coverage results to Coveralls.io. KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-} # once we have multiple group supports @@ -250,7 +253,7 @@ runTests() { # If we're not collecting coverage, run all requested tests with one 'go test' # command, which is much faster. if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then - kube::log::status "Running tests without code coverage" + kube::log::status "Running tests without code coverage ${KUBE_RACE:+"and with ${KUBE_RACE}"}" go test "${goflags[@]:+${goflags[@]}}" \ "${KUBE_TIMEOUT}" "${@}" \ "${testargs[@]:+${testargs[@]}}" \ @@ -260,6 +263,8 @@ runTests() { return ${rc} fi + kube::log::status "Running tests with code coverage ${KUBE_RACE:+"and with ${KUBE_RACE}"}" + # Create coverage report directories. if [[ -z "${KUBE_COVER_REPORT_DIR}" ]]; then cover_report_dir="/tmp/k8s_coverage/$(kube::util::sortable_date)"