Skip to content

Commit

Permalink
Merge pull request #214 from pohly/junit-fixes
Browse files Browse the repository at this point in the history
JUnit fixes
  • Loading branch information
k8s-ci-robot authored Dec 17, 2022
2 parents 78c0fb7 + b9b6763 commit b66c082
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion filter-junit.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type TestCase struct {
Name string `xml:"name,attr"`
Time string `xml:"time,attr"`
SystemOut string `xml:"system-out,omitempty"`
SystemErr string `xml:"system-err,omitempty"`
Failure string `xml:"failure,omitempty"`
Skipped SkipReason `xml:"skipped,omitempty"`
}
Expand Down Expand Up @@ -109,7 +110,7 @@ func main() {
if err := xml.Unmarshal(data, &junitv2); err != nil {
panic(err)
}
junit = junitv2.TestSuite
junit.TestCases = append(junit.TestCases, junitv2.TestSuite.TestCases...)
}
}

Expand Down
15 changes: 10 additions & 5 deletions prow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,10 @@ run_e2e () (
# the full Kubernetes E2E testsuite while only running a few tests.
move_junit () {
if ls "${ARTIFACTS}"/junit_[0-9]*.xml 2>/dev/null >/dev/null; then
run_filter_junit -t="External.Storage|CSI.mock.volume" -o "${ARTIFACTS}/junit_${name}.xml" "${ARTIFACTS}"/junit_[0-9]*.xml && rm -f "${ARTIFACTS}"/junit_[0-9]*.xml
mkdir -p "${ARTIFACTS}/junit/${name}" &&
mkdir -p "${ARTIFACTS}/junit/steps" &&
run_filter_junit -t="External.Storage|CSI.mock.volume" -o "${ARTIFACTS}/junit/steps/junit_${name}.xml" "${ARTIFACTS}"/junit_[0-9]*.xml &&
mv "${ARTIFACTS}"/junit_[0-9]*.xml "${ARTIFACTS}/junit/${name}/"
fi
}
trap move_junit EXIT
Expand Down Expand Up @@ -1085,13 +1088,14 @@ kubectl exec "$pod" -c "${CSI_PROW_SANITY_CONTAINER}" -- /bin/sh -c "\${CHECK_PA
EOF
chmod u+x "${CSI_PROW_WORK}"/*dir_in_pod.sh
mkdir -p "${ARTIFACTS}/junit/steps"
# This cannot run in parallel, because -csi.junitfile output
# from different Ginkgo nodes would go to the same file. Also the
# staging and target directories are the same.
run_with_loggers "${CSI_PROW_WORK}/csi-sanity" \
-ginkgo.v \
-csi.junitfile "${ARTIFACTS}/junit_sanity.xml" \
-csi.junitfile "${ARTIFACTS}/junit/steps/junit_sanity.xml" \
-csi.endpoint "dns:///$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' csi-prow-control-plane):$(kubectl get "services/${CSI_PROW_SANITY_SERVICE}" -o "jsonpath={..nodePort}")" \
-csi.stagingdir "/tmp/staging" \
-csi.mountdir "/tmp/mount" \
Expand Down Expand Up @@ -1121,7 +1125,8 @@ make_test_to_junit () {
# Plain make-test.xml was not delivered as text/xml by the web
# server and ignored by spyglass. It seems that the name has to
# match junit*.xml.
out="${ARTIFACTS}/junit_make_test.xml"
out="${ARTIFACTS}/junit/steps/junit_make_test.xml"
mkdir -p "$(dirname "$out")"
testname=
echo "<testsuite>" >>"$out"
Expand Down Expand Up @@ -1385,8 +1390,8 @@ main () {
fi
# Merge all junit files into one. This gets rid of duplicated "skipped" tests.
if ls "${ARTIFACTS}"/junit_*.xml 2>/dev/null >&2; then
run_filter_junit -o "${CSI_PROW_WORK}/junit_final.xml" "${ARTIFACTS}"/junit_*.xml && rm "${ARTIFACTS}"/junit_*.xml && mv "${CSI_PROW_WORK}/junit_final.xml" "${ARTIFACTS}"
if ls "${ARTIFACTS}"/junit/steps/junit_*.xml 2>/dev/null >&2; then
run_filter_junit -o "${ARTIFACTS}/junit_final.xml" "${ARTIFACTS}"/junit/steps/junit_*.xml
fi
return "$ret"
Expand Down

0 comments on commit b66c082

Please sign in to comment.