diff --git a/build/tools.go b/build/tools.go index 1a54b4bfa9b..78408152499 100644 --- a/build/tools.go +++ b/build/tools.go @@ -25,9 +25,10 @@ import ( _ "github.com/cespare/prettybench" _ "github.com/client9/misspell/cmd/misspell" _ "github.com/go-bindata/go-bindata/go-bindata" - _ "github.com/jstemmer/go-junit-report" _ "github.com/onsi/ginkgo/ginkgo" _ "golang.org/x/lint/golint" + _ "gotest.tools" + _ "gotest.tools/gotestsum" _ "k8s.io/code-generator/cmd/go-to-protobuf" _ "k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo" _ "k8s.io/gengo/examples/deepcopy-gen/generators" diff --git a/hack/jenkins/benchmark-dockerized.sh b/hack/jenkins/benchmark-dockerized.sh index 9e817a09e39..3804a2f9389 100755 --- a/hack/jenkins/benchmark-dockerized.sh +++ b/hack/jenkins/benchmark-dockerized.sh @@ -39,7 +39,7 @@ retry() { export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} go install k8s.io/kubernetes/vendor/github.com/cespare/prettybench -go install k8s.io/kubernetes/vendor/github.com/jstemmer/go-junit-report +go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum # Disable the Go race detector. export KUBE_RACE=" " diff --git a/hack/jenkins/gotest.sh b/hack/jenkins/gotest.sh index 22352d8ca6e..71971df4af9 100755 --- a/hack/jenkins/gotest.sh +++ b/hack/jenkins/gotest.sh @@ -32,7 +32,7 @@ export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:${PATH} # Install a few things needed by unit and /integration tests. command -v etcd &>/dev/null || ./hack/install-etcd.sh -go install k8s.io/kubernetes/vendor/github.com/jstemmer/go-junit-report +go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum # Enable the Go race detector. export KUBE_RACE=-race diff --git a/hack/jenkins/test-dockerized.sh b/hack/jenkins/test-dockerized.sh index c1660289750..8302264749c 100755 --- a/hack/jenkins/test-dockerized.sh +++ b/hack/jenkins/test-dockerized.sh @@ -37,7 +37,7 @@ retry() { export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} -go install k8s.io/kubernetes/vendor/github.com/jstemmer/go-junit-report +go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum # Enable the Go race detector. export KUBE_RACE=-race diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index 3d16e647921..d12f25edf44 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -149,7 +149,7 @@ eval "testargs=(${KUBE_TEST_ARGS:-})" # Used to filter verbose test output. go_test_grep_pattern=".*" -# The go-junit-report tool needs full test case information to produce a +# The junit report tool needs full test case information to produce a # meaningful report. if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then goflags+=(-v) @@ -241,19 +241,19 @@ produceJUnitXMLReport() { return fi - local test_stdout_filenames local junit_xml_filename - test_stdout_filenames=$(ls "${junit_filename_prefix}"*.stdout) junit_xml_filename="${junit_filename_prefix}.xml" - if ! command -v go-junit-report >/dev/null 2>&1; then - kube::log::error "go-junit-report not found; please install with " \ - "go get -u github.com/jstemmer/go-junit-report" + + if ! command -v gotestsum >/dev/null 2>&1; then + kube::log::error "gotestsum not found; please install with " \ + "go get -u gotest.tools/gotestsum" return fi - go-junit-report < "${test_stdout_filenames}" > "${junit_xml_filename}" + gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then - rm "${test_stdout_filenames}" + rm "${junit_filename_prefix}"*.stdout fi + kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}" } @@ -267,7 +267,7 @@ runTests() { # command, which is much faster. if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then kube::log::status "Running tests without code coverage" - go test "${goflags[@]:+${goflags[@]}}" \ + go test -json "${goflags[@]:+${goflags[@]}}" \ "${KUBE_TIMEOUT}" "${@}" \ "${testargs[@]:+${testargs[@]}}" \ | tee ${junit_filename_prefix:+"${junit_filename_prefix}.stdout"} \ @@ -307,7 +307,7 @@ runTests() { | grep -Ev ${cover_ignore_dirs} \ | xargs -I{} -n 1 -P "${KUBE_COVERPROCS}" \ bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \ - go test ${goflags[*]:+${goflags[*]}} \ + go test -json ${goflags[*]:+${goflags[*]}} \ ${KUBE_TIMEOUT} \ -cover -covermode=\"${KUBE_COVERMODE}\" \ -coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \