Squashed 'release-tools/' changes from e4dab7ff..d29a2e75
https://github.com/kubernetes-csi/csi-release-tools/commit/d29a2e75 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/198 from pohly/csi-test-5.0.0 https://github.com/kubernetes-csi/csi-release-tools/commit/41cb70d3 prow.sh: sanity testing with csi-test v5.0.0 https://github.com/kubernetes-csi/csi-release-tools/commit/c85a63fb Merge https://github.com/kubernetes-csi/csi-release-tools/pull/197 from pohly/fix-alpha-testing https://github.com/kubernetes-csi/csi-release-tools/commit/b86d8e94 support Kubernetes 1.25 + Ginkgo v2 https://github.com/kubernetes-csi/csi-release-tools/commit/ab0b0a3d Merge https://github.com/kubernetes-csi/csi-release-tools/pull/192 from andyzhangx/patch-1 https://github.com/kubernetes-csi/csi-release-tools/commit/7bbab24e Merge https://github.com/kubernetes-csi/csi-release-tools/pull/196 from humblec/non-alpha https://github.com/kubernetes-csi/csi-release-tools/commit/e51ff2cc introduce control variable for non alpha feature gate configuration https://github.com/kubernetes-csi/csi-release-tools/commit/ca19ef52 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/195 from pohly/fix-alpha-testing https://github.com/kubernetes-csi/csi-release-tools/commit/3948331e fix testing with latest Kubernetes https://github.com/kubernetes-csi/csi-release-tools/commit/9a0260c5 fix boilerplate header git-subtree-dir: release-tools git-subtree-split: d29a2e7547822371ebf3e61f7d2249c244879f85
This commit is contained in:
@@ -35,10 +35,18 @@ var (
|
||||
)
|
||||
|
||||
/*
|
||||
* TestSuite represents a JUnit file. Due to how encoding/xml works, we have
|
||||
* TestResults represents a JUnit file. Due to how encoding/xml works, we have
|
||||
* represent all fields that we want to be passed through. It's therefore
|
||||
* not a complete solution, but good enough for Ginkgo + Spyglass.
|
||||
*
|
||||
* Before Kubernetes 1.25 and ginkgo v2, we directly had <testsuite> in the
|
||||
* JUnit file. Now we get <testsuites> and inside it the <testsuite>.
|
||||
*/
|
||||
type TestResults struct {
|
||||
XMLName string `xml:"testsuites"`
|
||||
TestSuite TestSuite `xml:"testsuite"`
|
||||
}
|
||||
|
||||
type TestSuite struct {
|
||||
XMLName string `xml:"testsuite"`
|
||||
TestCases []TestCase `xml:"testcase"`
|
||||
@@ -93,7 +101,15 @@ func main() {
|
||||
}
|
||||
}
|
||||
if err := xml.Unmarshal(data, &junit); err != nil {
|
||||
panic(err)
|
||||
if err.Error() != "expected element type <testsuite> but have <testsuites>" {
|
||||
panic(err)
|
||||
}
|
||||
// Fall back to Ginkgo v2 format.
|
||||
var junitv2 TestResults
|
||||
if err := xml.Unmarshal(data, &junitv2); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
junit = junitv2.TestSuite
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user