Skip to content

Commit 2808df6

Browse files
committed
Squashed 'release-tools/' changes from ab0b0a3..d29a2e7
kubernetes-csi/csi-release-tools@d29a2e75 Merge kubernetes-csi/csi-release-tools#198 from pohly/csi-test-5.0.0 kubernetes-csi/csi-release-tools@41cb70d3 prow.sh: sanity testing with csi-test v5.0.0 kubernetes-csi/csi-release-tools@c85a63fb Merge kubernetes-csi/csi-release-tools#197 from pohly/fix-alpha-testing kubernetes-csi/csi-release-tools@b86d8e94 support Kubernetes 1.25 + Ginkgo v2 git-subtree-dir: release-tools git-subtree-split: d29a2e7
1 parent 6f79cfe commit 2808df6

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

filter-junit.go

+18-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ var (
3535
)
3636

3737
/*
38-
* TestSuite represents a JUnit file. Due to how encoding/xml works, we have
38+
* TestResults represents a JUnit file. Due to how encoding/xml works, we have
3939
* represent all fields that we want to be passed through. It's therefore
4040
* not a complete solution, but good enough for Ginkgo + Spyglass.
41+
*
42+
* Before Kubernetes 1.25 and ginkgo v2, we directly had <testsuite> in the
43+
* JUnit file. Now we get <testsuites> and inside it the <testsuite>.
4144
*/
45+
type TestResults struct {
46+
XMLName string `xml:"testsuites"`
47+
TestSuite TestSuite `xml:"testsuite"`
48+
}
49+
4250
type TestSuite struct {
4351
XMLName string `xml:"testsuite"`
4452
TestCases []TestCase `xml:"testcase"`
@@ -93,7 +101,15 @@ func main() {
93101
}
94102
}
95103
if err := xml.Unmarshal(data, &junit); err != nil {
96-
panic(err)
104+
if err.Error() != "expected element type <testsuite> but have <testsuites>" {
105+
panic(err)
106+
}
107+
// Fall back to Ginkgo v2 format.
108+
var junitv2 TestResults
109+
if err := xml.Unmarshal(data, &junitv2); err != nil {
110+
panic(err)
111+
}
112+
junit = junitv2.TestSuite
97113
}
98114
}
99115

prow.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version fo
9393
configvar CSI_PROW_GO_VERSION_GINKGO "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building ginkgo" # depends on CSI_PROW_GINKGO_VERSION below
9494

9595
# ginkgo test runner version to use. If the pre-installed version is
96-
# different, the desired version is built from source.
96+
# different, the desired version is built from source. For Kubernetes,
97+
# the version built via "make WHAT=vendor/github.com/onsi/ginkgo/ginkgo" is
98+
# used, which is guaranteed to match what the Kubernetes e2e.test binary
99+
# needs.
97100
configvar CSI_PROW_GINKGO_VERSION v1.7.0 "Ginkgo"
98101

99102
# Ginkgo runs the E2E test in parallel. The default is based on the number
@@ -234,7 +237,7 @@ configvar CSI_PROW_E2E_IMPORT_PATH "k8s.io/kubernetes" "E2E package"
234237
# of the cluster. The alternative would have been to (cross-)compile csi-sanity
235238
# and install it inside the cluster, which is not necessarily easier.
236239
configvar CSI_PROW_SANITY_REPO https://github.com/kubernetes-csi/csi-test "csi-test repo"
237-
configvar CSI_PROW_SANITY_VERSION v4.3.0 "csi-test version"
240+
configvar CSI_PROW_SANITY_VERSION v5.0.0 "csi-test version"
238241
configvar CSI_PROW_SANITY_PACKAGE_PATH github.com/kubernetes-csi/csi-test "csi-test package"
239242
configvar CSI_PROW_SANITY_SERVICE "hostpath-service" "Kubernetes TCP service name that exposes csi.sock"
240243
configvar CSI_PROW_SANITY_POD "csi-hostpathplugin-0" "Kubernetes pod with CSI driver"
@@ -440,6 +443,10 @@ install_kind () {
440443

441444
# Ensure that we have the desired version of the ginkgo test runner.
442445
install_ginkgo () {
446+
if [ -e "${CSI_PROW_BIN}/ginkgo" ]; then
447+
return
448+
fi
449+
443450
# CSI_PROW_GINKGO_VERSION contains the tag with v prefix, the command line output does not.
444451
if [ "v$(ginkgo version 2>/dev/null | sed -e 's/.* //')" = "${CSI_PROW_GINKGO_VERSION}" ]; then
445452
return
@@ -943,7 +950,9 @@ install_e2e () {
943950
patch_kubernetes "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_WORK}" &&
944951
go_version="${CSI_PROW_GO_VERSION_E2E:-$(go_version_for_kubernetes "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_E2E_VERSION}")}" &&
945952
run_with_go "$go_version" make WHAT=test/e2e/e2e.test "-C${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
946-
ln -s "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}/_output/bin/e2e.test" "${CSI_PROW_WORK}"
953+
ln -s "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}/_output/bin/e2e.test" "${CSI_PROW_WORK}" &&
954+
run_with_go "$go_version" make WHAT=vendor/github.com/onsi/ginkgo/ginkgo "-C${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
955+
ln -s "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}/_output/bin/ginkgo" "${CSI_PROW_BIN}"
947956
else
948957
run_with_go "${CSI_PROW_GO_VERSION_E2E}" go test -c -o "${CSI_PROW_WORK}/e2e.test" "${CSI_PROW_E2E_IMPORT_PATH}/test/e2e"
949958
fi

0 commit comments

Comments
 (0)