mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +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/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"
|
||||
|
@ -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=" "
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}\" \
|
||||
|
Loading…
Reference in New Issue
Block a user