@@ -780,6 +780,27 @@ install_csi_driver () {
780780 info " For container output see job artifacts."
781781 die " deploying the CSI driver with ${deploy_driver} failed"
782782 fi
783+
784+ if [ " ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} " = " true" ]; then
785+ yq -i ' .GroupSnapshotClass.FromName = true' " ${CSI_PROW_WORK} /test-driver.yaml"
786+ yq -i ' .DriverInfo.Capabilities.groupSnapshot = true' " ${CSI_PROW_WORK} /test-driver.yaml"
787+ cat " ${CSI_PROW_WORK} /test-driver.yaml"
788+
789+ kubectl get sts csi-hostpathplugin -n default -o yaml \
790+ | yq ' (.spec.template.spec.containers[] | select(.name == "csi-snapshotter") | .args) += ["--feature-gates=CSIVolumeGroupSnapshot=true"]' \
791+ | kubectl apply -f -
792+
793+ SNAPSHOTTER_IMAGE=" registry.k8s.io/sig-storage/csi-snapshotter:${CSI_SNAPSHOTTER_VERSION} "
794+ kubectl get sts csi-hostpathplugin -n default -o yaml \
795+ | yq " (.spec.template.spec.containers[] | select(.name == \" csi-snapshotter\" ) | .image) = \" ${SNAPSHOTTER_IMAGE} \" " \
796+ | kubectl apply -f -
797+
798+ # Restart the StatefulSet
799+ kubectl rollout restart sts csi-hostpathplugin -n default
800+
801+ # Wait for the rollout to complete
802+ kubectl rollout status sts csi-hostpathplugin -n default
803+ fi
783804}
784805
785806# Installs all necessary snapshotter CRDs
@@ -1096,73 +1117,32 @@ run_e2e () (
10961117 install_e2e || die " building e2e.test failed"
10971118 install_ginkgo || die " installing ginkgo failed"
10981119
1120+ # TODO: Download the filter-junit.go from prow job level
1121+ if [[ $( basename " ${REPO_DIR} " ) == " kubernetes" ]]; then
1122+ curl -fsSL https://raw.githubusercontent.com/Phaow/csi-release-tools/dev/filter-junit.go -o " ${REPO_DIR} " /filter-junit.go
1123+ fi
1124+
10991125 # Rename, merge and filter JUnit files. Necessary in case that we run the E2E suite again
11001126 # and to avoid the large number of "skipped" tests that we get from using
11011127 # the full Kubernetes E2E testsuite while only running a few tests.
11021128 # shellcheck disable=SC2329
11031129 move_junit () {
1104- # shellcheck disable=SC2317
11051130 if ls " ${ARTIFACTS} " /junit_[0-9]* .xml 2> /dev/null > /dev/null; then
11061131 mkdir -p " ${ARTIFACTS} /junit/${name} " &&
1107- mkdir -p " ${ARTIFACTS} /junit/steps"
1108-
1109- # Skip filter-junit for in-tree (VGS) runs, because k/k already produces clean JUnit
1110- if [[ " ${name} " == " vgs" ]]; then
1111- echo " Skipping filter-junit for ${name} (in-tree tests already generate clean JUnit)"
1132+ mkdir -p " ${ARTIFACTS} /junit/steps" &&
1133+ run_filter_junit -t=" External.Storage|CSI.mock.volume" -o " ${ARTIFACTS} /junit/steps/junit_${name} .xml" " ${ARTIFACTS} " /junit_[0-9]* .xml &&
11121134 mv " ${ARTIFACTS} " /junit_[0-9]* .xml " ${ARTIFACTS} /junit/${name} /"
1113- else
1114- # Run filtering for CSI tests to remove duplicates/skipped cases
1115- run_filter_junit -t=" External.Storage|CSI.mock.volume" \
1116- -o " ${ARTIFACTS} /junit/steps/junit_${name} .xml" \
1117- " ${ARTIFACTS} " /junit_[0-9]* .xml &&
1118- mv " ${ARTIFACTS} " /junit_[0-9]* .xml " ${ARTIFACTS} /junit/${name} /"
1119- fi
11201135 fi
11211136 }
11221137 trap move_junit EXIT
11231138
1124-
1125- # Only set up move_junit for non-VGS tests
1126- if [ " $name " != " vgs" ]; then
1127- trap move_junit EXIT
1128- fi
1129-
1130- # Determine ginkgo target and options
1131- local ginkgo_target=" "
1132- local extra_args=" "
1133- local e2e_src_dir=" "
1134- local args=()
1135-
1136- if [[ $( basename " ${REPO_DIR} " ) == " kubernetes" ]]; then
1137- e2e_src_dir=" ${REPO_DIR} "
1139+ if [ " ${name} " == " local" ]; then
1140+ cd " ${GOPATH} /src/${CSI_PROW_SIDECAR_E2E_PATH} " &&
1141+ run_with_loggers env KUBECONFIG=" $KUBECONFIG " KUBE_TEST_REPO_LIST=" $( if [ -e " ${CSI_PROW_WORK} /e2e-repo-list" ]; then echo " ${CSI_PROW_WORK} /e2e-repo-list" ; fi) " ginkgo --timeout=" ${CSI_PROW_GINKGO_TIMEOUT} " -v " $@ " " ${CSI_PROW_WORK} /e2e-local.test" -- -report-dir " ${ARTIFACTS} " -report-prefix local
11381142 else
1139- e2e_src_dir=" ${GOPATH} /src/${CSI_PROW_E2E_IMPORT_PATH} "
1143+ cd " ${GOPATH} /src/${CSI_PROW_E2E_IMPORT_PATH} " &&
1144+ run_with_loggers env KUBECONFIG=" $KUBECONFIG " KUBE_TEST_REPO_LIST=" $( if [ -e " ${CSI_PROW_WORK} /e2e-repo-list" ]; then echo " ${CSI_PROW_WORK} /e2e-repo-list" ; fi) " ginkgo --timeout=" ${CSI_PROW_GINKGO_TIMEOUT} " -v " $@ " " ${CSI_PROW_WORK} /e2e.test" -- -report-dir " ${ARTIFACTS} " -storage.testdriver=" ${CSI_PROW_WORK} /test-driver.yaml"
11401145 fi
1141-
1142- case " $name " in
1143- local)
1144- ginkgo_target=" ${CSI_PROW_WORK} /e2e-local.test"
1145- extra_args=" -report-prefix=local"
1146- cd " ${GOPATH} /src/${CSI_PROW_SIDECAR_E2E_PATH} " || die " cd ${GOPATH} /src/${CSI_PROW_SIDECAR_E2E_PATH} failed"
1147- ;;
1148- vgs)
1149- # VGS tests are in in-tree/core tests; do NOT pass -storage.testdriver
1150- ginkgo_target=" ${CSI_PROW_WORK} /e2e.test"
1151- cd " ${e2e_src_dir} " || die " cd ${e2e_src_dir} failed"
1152- ;;
1153- * )
1154- # Default: CSI external driver tests
1155- ginkgo_target=" ${CSI_PROW_WORK} /e2e.test"
1156- extra_args=" -storage.testdriver=${CSI_PROW_WORK} /test-driver.yaml"
1157- cd " ${e2e_src_dir} " || die " cd ${e2e_src_dir} failed"
1158- ;;
1159- esac
1160-
1161- [ -n " $extra_args " ] && args+=(" $extra_args " )
1162- run_with_loggers env \
1163- KUBECONFIG=" $KUBECONFIG " \
1164- KUBE_TEST_REPO_LIST=" $( if [ -e " ${CSI_PROW_WORK} /e2e-repo-list" ]; then echo " ${CSI_PROW_WORK} /e2e-repo-list" ; fi) " \
1165- ginkgo --timeout=" ${CSI_PROW_GINKGO_TIMEOUT} " -v " $@ " " $ginkgo_target " -- -report-dir " ${ARTIFACTS} " " ${args[@]} "
11661146)
11671147
11681148# Run csi-sanity against installed CSI driver.
@@ -1356,13 +1336,32 @@ function version_gt() {
13561336 test " $( printf ' %s' " $versions " | sort -V | head -n 1) " ! = " $greaterVersion "
13571337}
13581338
1339+ install_yq_if_missing () {
1340+ local version=" ${1:- v4.48.1} "
1341+ local yq_path=" /usr/local/bin/yq"
1342+ if ! command -v yq & > /dev/null; then
1343+ echo " Installing yq ${version} ..."
1344+ if ! curl -fsSL -o " ${yq_path} " " https://github.com/mikefarah/yq/releases/download/${version} /yq_linux_amd64" ; then
1345+ echo " Failed to download yq" >&2
1346+ exit 1
1347+ fi
1348+ chmod +x " ${yq_path} "
1349+ echo " yq ${version} installed at ${yq_path} "
1350+ else
1351+ echo " yq found, skipping install"
1352+ fi
1353+ }
1354+
13591355main () {
13601356 local images ret
13611357 ret=0
13621358
13631359 # Set up work directory.
13641360 ensure_paths
13651361
1362+ # Temporary install yq
1363+ install_yq_if_missing
1364+
13661365 images=
13671366 if ${CSI_PROW_BUILD_JOB} ; then
13681367 # A successful build is required for testing.
@@ -1489,18 +1488,6 @@ main () {
14891488 ret=1
14901489 fi
14911490 fi
1492-
1493- # Run VGS in-tree tests only if enabled
1494- if [ " ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} " = " true" ]; then
1495- vgs_focus=" \[Feature:volumegroupsnapshot\]"
1496- if ! run_e2e vgs \
1497- -focus=" ${vgs_focus} " \
1498- -skip=" $( regex_join " ${CSI_PROW_E2E_SERIAL} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
1499- warn " E2E VGS tests failed"
1500- ret=1
1501- fi
1502- fi
1503-
15041491 fi
15051492 delete_cluster_inside_prow_job non-alpha
15061493 fi
0 commit comments