mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Switch to json test output
This commit is contained in:
parent
7232c0fd0b
commit
93c02e164f
@ -25,9 +25,10 @@ import (
|
|||||||
_ "github.com/cespare/prettybench"
|
_ "github.com/cespare/prettybench"
|
||||||
_ "github.com/client9/misspell/cmd/misspell"
|
_ "github.com/client9/misspell/cmd/misspell"
|
||||||
_ "github.com/go-bindata/go-bindata/go-bindata"
|
_ "github.com/go-bindata/go-bindata/go-bindata"
|
||||||
_ "github.com/jstemmer/go-junit-report"
|
|
||||||
_ "github.com/onsi/ginkgo/ginkgo"
|
_ "github.com/onsi/ginkgo/ginkgo"
|
||||||
_ "golang.org/x/lint/golint"
|
_ "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"
|
||||||
_ "k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo"
|
_ "k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo"
|
||||||
_ "k8s.io/gengo/examples/deepcopy-gen/generators"
|
_ "k8s.io/gengo/examples/deepcopy-gen/generators"
|
||||||
|
@ -39,7 +39,7 @@ retry() {
|
|||||||
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
|
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/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.
|
# Disable the Go race detector.
|
||||||
export KUBE_RACE=" "
|
export KUBE_RACE=" "
|
||||||
|
@ -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.
|
# Install a few things needed by unit and /integration tests.
|
||||||
command -v etcd &>/dev/null || ./hack/install-etcd.sh
|
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.
|
# Enable the Go race detector.
|
||||||
export KUBE_RACE=-race
|
export KUBE_RACE=-race
|
||||||
|
@ -37,7 +37,7 @@ retry() {
|
|||||||
|
|
||||||
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
|
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.
|
# Enable the Go race detector.
|
||||||
export KUBE_RACE=-race
|
export KUBE_RACE=-race
|
||||||
|
@ -149,7 +149,7 @@ eval "testargs=(${KUBE_TEST_ARGS:-})"
|
|||||||
# Used to filter verbose test output.
|
# Used to filter verbose test output.
|
||||||
go_test_grep_pattern=".*"
|
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.
|
# meaningful report.
|
||||||
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
|
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
|
||||||
goflags+=(-v)
|
goflags+=(-v)
|
||||||
@ -241,19 +241,19 @@ produceJUnitXMLReport() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local test_stdout_filenames
|
|
||||||
local junit_xml_filename
|
local junit_xml_filename
|
||||||
test_stdout_filenames=$(ls "${junit_filename_prefix}"*.stdout)
|
|
||||||
junit_xml_filename="${junit_filename_prefix}.xml"
|
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 " \
|
if ! command -v gotestsum >/dev/null 2>&1; then
|
||||||
"go get -u github.com/jstemmer/go-junit-report"
|
kube::log::error "gotestsum not found; please install with " \
|
||||||
|
"go get -u gotest.tools/gotestsum"
|
||||||
return
|
return
|
||||||
fi
|
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
|
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
|
||||||
rm "${test_stdout_filenames}"
|
rm "${junit_filename_prefix}"*.stdout
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}"
|
kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ runTests() {
|
|||||||
# command, which is much faster.
|
# command, which is much faster.
|
||||||
if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
|
if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
|
||||||
kube::log::status "Running tests without code coverage"
|
kube::log::status "Running tests without code coverage"
|
||||||
go test "${goflags[@]:+${goflags[@]}}" \
|
go test -json "${goflags[@]:+${goflags[@]}}" \
|
||||||
"${KUBE_TIMEOUT}" "${@}" \
|
"${KUBE_TIMEOUT}" "${@}" \
|
||||||
"${testargs[@]:+${testargs[@]}}" \
|
"${testargs[@]:+${testargs[@]}}" \
|
||||||
| tee ${junit_filename_prefix:+"${junit_filename_prefix}.stdout"} \
|
| tee ${junit_filename_prefix:+"${junit_filename_prefix}.stdout"} \
|
||||||
@ -307,7 +307,7 @@ runTests() {
|
|||||||
| grep -Ev ${cover_ignore_dirs} \
|
| grep -Ev ${cover_ignore_dirs} \
|
||||||
| xargs -I{} -n 1 -P "${KUBE_COVERPROCS}" \
|
| xargs -I{} -n 1 -P "${KUBE_COVERPROCS}" \
|
||||||
bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \
|
bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \
|
||||||
go test ${goflags[*]:+${goflags[*]}} \
|
go test -json ${goflags[*]:+${goflags[*]}} \
|
||||||
${KUBE_TIMEOUT} \
|
${KUBE_TIMEOUT} \
|
||||||
-cover -covermode=\"${KUBE_COVERMODE}\" \
|
-cover -covermode=\"${KUBE_COVERMODE}\" \
|
||||||
-coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \
|
-coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \
|
||||||
|
Loading…
Reference in New Issue
Block a user