Skip to content

Commit

Permalink
Make Junit report success callout message conditional
Browse files Browse the repository at this point in the history
Also add $GOPATH/bin to $PATH
  • Loading branch information
Rajalakshmi-Girish committed Jun 28, 2021
1 parent 8bfce5d commit 2e41fbf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/test_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,26 @@ function produce_junit_xmlreport {

local junit_xml_filename
junit_xml_filename="${junit_filename_prefix}.xml"
local PATH

if ! command -v gotestsum >/dev/null 2>&1; then
log_callout "gotestsum not found; installing now"
pushd "${ETCD_ROOT_DIR}/tools/mod" >/dev/null || return
GO111MODULE=on go install gotest.tools/gotestsum
popd >/dev/null || return
export PATH=$(go env PATH):$(go env GOPATH)/bin
fi
gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout
local cmd_code=$?
if [ "${VERBOSE}" != "1" ]; then
rm "${junit_filename_prefix}"*.stdout
fi

log_callout "Saved JUnit XML test report to ${junit_xml_filename}"
if [ ${cmd_code} -ne 0 ]; then
log_error "gotestsum failed and did not generate JUnit XML test report"
else
log_callout "Saved JUnit XML test report to ${junit_xml_filename}"
fi
}


Expand Down

0 comments on commit 2e41fbf

Please sign in to comment.