Skip to content

Commit 93c02e1

Browse files
committed
Switch to json test output
1 parent 7232c0f commit 93c02e1

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

build/tools.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import (
2525
_ "github.com/cespare/prettybench"
2626
_ "github.com/client9/misspell/cmd/misspell"
2727
_ "github.com/go-bindata/go-bindata/go-bindata"
28-
_ "github.com/jstemmer/go-junit-report"
2928
_ "github.com/onsi/ginkgo/ginkgo"
3029
_ "golang.org/x/lint/golint"
30+
_ "gotest.tools"
31+
_ "gotest.tools/gotestsum"
3132
_ "k8s.io/code-generator/cmd/go-to-protobuf"
3233
_ "k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo"
3334
_ "k8s.io/gengo/examples/deepcopy-gen/generators"

hack/jenkins/benchmark-dockerized.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ retry() {
3939
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
4040

4141
go install k8s.io/kubernetes/vendor/github.com/cespare/prettybench
42-
go install k8s.io/kubernetes/vendor/github.com/jstemmer/go-junit-report
42+
go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum
4343

4444
# Disable the Go race detector.
4545
export KUBE_RACE=" "

hack/jenkins/gotest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:${PATH}
3232

3333
# Install a few things needed by unit and /integration tests.
3434
command -v etcd &>/dev/null || ./hack/install-etcd.sh
35-
go install k8s.io/kubernetes/vendor/github.com/jstemmer/go-junit-report
35+
go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum
3636

3737
# Enable the Go race detector.
3838
export KUBE_RACE=-race

hack/jenkins/test-dockerized.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ retry() {
3737

3838
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
3939

40-
go install k8s.io/kubernetes/vendor/github.com/jstemmer/go-junit-report
40+
go install k8s.io/kubernetes/vendor/gotest.tools/gotestsum
4141

4242
# Enable the Go race detector.
4343
export KUBE_RACE=-race

hack/make-rules/test.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ eval "testargs=(${KUBE_TEST_ARGS:-})"
149149
# Used to filter verbose test output.
150150
go_test_grep_pattern=".*"
151151

152-
# The go-junit-report tool needs full test case information to produce a
152+
# The junit report tool needs full test case information to produce a
153153
# meaningful report.
154154
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
155155
goflags+=(-v)
@@ -241,19 +241,19 @@ produceJUnitXMLReport() {
241241
return
242242
fi
243243

244-
local test_stdout_filenames
245244
local junit_xml_filename
246-
test_stdout_filenames=$(ls "${junit_filename_prefix}"*.stdout)
247245
junit_xml_filename="${junit_filename_prefix}.xml"
248-
if ! command -v go-junit-report >/dev/null 2>&1; then
249-
kube::log::error "go-junit-report not found; please install with " \
250-
"go get -u github.com/jstemmer/go-junit-report"
246+
247+
if ! command -v gotestsum >/dev/null 2>&1; then
248+
kube::log::error "gotestsum not found; please install with " \
249+
"go get -u gotest.tools/gotestsum"
251250
return
252251
fi
253-
go-junit-report < "${test_stdout_filenames}" > "${junit_xml_filename}"
252+
gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout
254253
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
255-
rm "${test_stdout_filenames}"
254+
rm "${junit_filename_prefix}"*.stdout
256255
fi
256+
257257
kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}"
258258
}
259259

@@ -267,7 +267,7 @@ runTests() {
267267
# command, which is much faster.
268268
if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
269269
kube::log::status "Running tests without code coverage"
270-
go test "${goflags[@]:+${goflags[@]}}" \
270+
go test -json "${goflags[@]:+${goflags[@]}}" \
271271
"${KUBE_TIMEOUT}" "${@}" \
272272
"${testargs[@]:+${testargs[@]}}" \
273273
| tee ${junit_filename_prefix:+"${junit_filename_prefix}.stdout"} \
@@ -307,7 +307,7 @@ runTests() {
307307
| grep -Ev ${cover_ignore_dirs} \
308308
| xargs -I{} -n 1 -P "${KUBE_COVERPROCS}" \
309309
bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \
310-
go test ${goflags[*]:+${goflags[*]}} \
310+
go test -json ${goflags[*]:+${goflags[*]}} \
311311
${KUBE_TIMEOUT} \
312312
-cover -covermode=\"${KUBE_COVERMODE}\" \
313313
-coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \

0 commit comments

Comments
 (0)