@@ -149,7 +149,7 @@ eval "testargs=(${KUBE_TEST_ARGS:-})"
149
149
# Used to filter verbose test output.
150
150
go_test_grep_pattern=" .*"
151
151
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
153
153
# meaningful report.
154
154
if [[ -n " ${KUBE_JUNIT_REPORT_DIR} " ]] ; then
155
155
goflags+=(-v)
@@ -241,19 +241,19 @@ produceJUnitXMLReport() {
241
241
return
242
242
fi
243
243
244
- local test_stdout_filenames
245
244
local junit_xml_filename
246
- test_stdout_filenames=$( ls " ${junit_filename_prefix} " * .stdout)
247
245
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"
251
250
return
252
251
fi
253
- go-junit-report < " ${test_stdout_filenames } " > " ${junit_xml_filename} "
252
+ gotestsum --junitfile " ${junit_xml_filename } " --raw-command cat " ${junit_filename_prefix} " * .stdout
254
253
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
255
- rm " ${test_stdout_filenames} "
254
+ rm " ${junit_filename_prefix} " * .stdout
256
255
fi
256
+
257
257
kube::log::status " Saved JUnit XML test report to ${junit_xml_filename} "
258
258
}
259
259
@@ -267,7 +267,7 @@ runTests() {
267
267
# command, which is much faster.
268
268
if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
269
269
kube::log::status " Running tests without code coverage"
270
- go test " ${goflags[@]: +${goflags[@]} } " \
270
+ go test -json " ${goflags[@]: +${goflags[@]} } " \
271
271
" ${KUBE_TIMEOUT} " " ${@ } " \
272
272
" ${testargs[@]: +${testargs[@]} } " \
273
273
| tee ${junit_filename_prefix: +" ${junit_filename_prefix} .stdout" } \
@@ -307,7 +307,7 @@ runTests() {
307
307
| grep -Ev ${cover_ignore_dirs} \
308
308
| xargs -I{} -n 1 -P " ${KUBE_COVERPROCS} " \
309
309
bash -c " set -o pipefail; _pkg=\"\$ 0\" ; _pkg_out=\$ {_pkg//\//_}; \
310
- go test ${goflags[*]: +${goflags[*]} } \
310
+ go test -json ${goflags[*]: +${goflags[*]} } \
311
311
${KUBE_TIMEOUT} \
312
312
-cover -covermode=\" ${KUBE_COVERMODE} \" \
313
313
-coverprofile=\" ${cover_report_dir} /\$ {_pkg}/${cover_profile} \" \
0 commit comments