From 38e11468fa6bf056f5be9748bb708a9612c6f2b9 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Sat, 17 Dec 2022 17:42:13 +0100 Subject: [PATCH 1/3] prow.sh: publish individual JUnit files as separate artifacts "junit/steps/junit_*.xml" contains the summary JUnit file of each step (sanity, make_test, etc.). The original files as written by the e2e.test binary are under "junit/" where name is "parallel", "serial", etc. This makes it possible to look up information that might get lost during the transformation with filter-junit.go and debug that command. --- prow.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/prow.sh b/prow.sh index 55c3231d..6154bd59 100755 --- a/prow.sh +++ b/prow.sh @@ -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 @@ -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" \ @@ -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 "" >>"$out" @@ -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" From d4277839f43a0ea69ca37501a768dffaeac9a2de Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Sat, 17 Dec 2022 17:45:34 +0100 Subject: [PATCH 2/3] filter-junit.go: preserve system error log Ginkgo v2 uses "system-err" to represent the log output of a test. This only matters for failed tests, but for those it is important to preserve that information. --- filter-junit.go | 1 + 1 file changed, 1 insertion(+) diff --git a/filter-junit.go b/filter-junit.go index 5454092b..8eb1b8e4 100644 --- a/filter-junit.go +++ b/filter-junit.go @@ -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"` } From b9b6763bd7237b925c04cd32b2ff0af7602852b2 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Sat, 17 Dec 2022 17:46:35 +0100 Subject: [PATCH 3/3] filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit The "junit" variable is meant to accumulate all testcases from the input files. Overwriting it with the content of an input file when that input file used the new Ginkgo V2 JUnit caused the result of prior input files to get lost. --- filter-junit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter-junit.go b/filter-junit.go index 8eb1b8e4..c1b7b619 100644 --- a/filter-junit.go +++ b/filter-junit.go @@ -110,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...) } }