mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #80863 from liggitt/conditional-json
Only output json format from tests when building junit reports
This commit is contained in:
commit
933f9a469f
@ -153,6 +153,7 @@ go_test_grep_pattern=".*"
|
|||||||
# meaningful report.
|
# meaningful report.
|
||||||
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
|
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
|
||||||
goflags+=(-v)
|
goflags+=(-v)
|
||||||
|
goflags+=(-json)
|
||||||
# Show only summary lines by matching lines like "status package/test"
|
# Show only summary lines by matching lines like "status package/test"
|
||||||
go_test_grep_pattern="^[^[:space:]]\+[[:space:]]\+[^[:space:]]\+/[^[[:space:]]\+"
|
go_test_grep_pattern="^[^[:space:]]\+[[:space:]]\+[^[:space:]]\+/[^[[:space:]]\+"
|
||||||
fi
|
fi
|
||||||
@ -246,7 +247,7 @@ produceJUnitXMLReport() {
|
|||||||
|
|
||||||
if ! command -v gotestsum >/dev/null 2>&1; then
|
if ! command -v gotestsum >/dev/null 2>&1; then
|
||||||
kube::log::error "gotestsum not found; please install with " \
|
kube::log::error "gotestsum not found; please install with " \
|
||||||
"go get -u gotest.tools/gotestsum"
|
"go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout
|
gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout
|
||||||
@ -267,7 +268,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 -json "${goflags[@]:+${goflags[@]}}" \
|
go test "${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 +308,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 -json ${goflags[*]:+${goflags[*]}} \
|
go test ${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