Merge pull request #102960 from BenTheElder/nodataracesplease

enable race detector by default in make test
This commit is contained in:
Kubernetes Prow Robot 2021-06-18 19:26:49 -07:00 committed by GitHub
commit 2d0821c2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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)"