Skip to content

Commit 16ba1ea

Browse files
authored
Add gotestsum option for integration test execution which is suitable for polarion xml parsing (#503)
1 parent 334b2ee commit 16ba1ea

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

prow/integ-suite-ocp.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,34 @@ if [ "${TEST_OUTPUT_FORMAT}" == "junit" ]; then
241241
setup_junit_report
242242
"${base_cmd[@]}" 2>&1 | tee >( "${JUNIT_REPORT}" > "${ARTIFACTS_DIR}/junit/junit.xml" )
243243
test_status=${PIPESTATUS[0]}
244+
245+
elif [ "${TEST_OUTPUT_FORMAT}" == "gotestsum" ]; then
246+
echo "Using gotestsum to run tests and generate junit report"
247+
# Install gotestsum if not already available
248+
if ! command -v gotestsum &>/dev/null; then
249+
go install gotest.tools/gotestsum@latest
250+
# Get Go binary path (prefer GOBIN, fallback to GOPATH/bin)
251+
gobin=$(go env GOBIN 2>/dev/null)
252+
if [ -z "$gobin" ]; then
253+
gobin="$(go env GOPATH)/bin"
254+
fi
255+
export PATH="$gobin:$PATH"
256+
fi
257+
258+
mkdir -p "${JUNIT_REPORT_DIR}"
259+
260+
gotestsum \
261+
-f testname \
262+
--junitfile-project-name istio \
263+
--junitfile "${JUNIT_REPORT_DIR}/junit.xml" \
264+
--rerun-fails \
265+
--rerun-fails-max-failures=3 \
266+
--packages "${TEST_PATH[@]}" \
267+
--debug \
268+
-- "${base_cmd[@]:5}"
269+
270+
test_status=$?
271+
244272
else
245273
"${base_cmd[@]}"
246274
test_status=$?

0 commit comments

Comments
 (0)