@@ -138,16 +138,62 @@ else
138138 set -x
139139 set +e
140140 # kubetest2 looks for deployers/testers in $PATH
141- PATH=" ${BIN} :${PATH} " " ${BIN} /kubetest2" noop \
142- --run-id=" e2e-kubernetes" \
143- --test=ginkgo \
144- -- \
145- --skip-regex=" ${GINKGO_SKIP} " \
146- --focus-regex=" ${GINKGO_FOCUS} " \
147- --test-package-version=$( curl -L https://dl.k8s.io/release/stable-${packageVersion} .txt) \
148- --parallel=${GINKGO_PARALLEL} \
149- --test-args=" -storage.testdriver=${PWD} /manifests.yaml -kubeconfig=${KUBECONFIG} -node-os-distro=${NODE_OS_DISTRO} "
150- TEST_PASSED=$?
141+
142+ # Regex matching volume expansion tests susceptible to transient failures on Windows due to defragsvc contention.
143+ WINDOWS_VOLUME_EXPAND_REGEX=" volume-expand|expansion of pvcs created for ephemeral"
144+
145+ TEST_PACKAGE_VERSION=$( curl -L https://dl.k8s.io/release/stable-${packageVersion} .txt)
146+
147+ run_kubetest2 () {
148+ local run_id=" $1 "
149+ local skip=" $2 "
150+ local focus=" $3 "
151+ local extra_ginkgo_args=" ${4:- } "
152+
153+ PATH=" ${BIN} :${PATH} " " ${BIN} /kubetest2" noop \
154+ --run-id=" ${run_id} " \
155+ --test=ginkgo \
156+ -- \
157+ --skip-regex=" ${skip} " \
158+ --focus-regex=" ${focus} " \
159+ --test-package-version=" ${TEST_PACKAGE_VERSION} " \
160+ --parallel=${GINKGO_PARALLEL} \
161+ ${extra_ginkgo_args: +--ginkgo-args=" ${extra_ginkgo_args} " } \
162+ --test-args=" -storage.testdriver=${PWD} /manifests.yaml -kubeconfig=${KUBECONFIG} -node-os-distro=${NODE_OS_DISTRO} "
163+ }
164+
165+ if [[ " ${WINDOWS} " == true ]]; then
166+ # Pass 1: Run all tests except volume-expand (no retries).
167+ loudecho " Running non-volume-expand tests (no retries)"
168+ run_kubetest2 " e2e-kubernetes" \
169+ " ${GINKGO_SKIP} |${WINDOWS_VOLUME_EXPAND_REGEX} " \
170+ " ${GINKGO_FOCUS} "
171+ TEST_PASSED=$?
172+
173+ # Preserve Pass 1 JUnit results before Pass 2 overwrites them.
174+ # kubetest2 writes JUnit XML to $ARTIFACTS (or ./_artifacts if unset).
175+ _JUNIT_DIR=" ${ARTIFACTS:- _artifacts} "
176+ for f in " ${_JUNIT_DIR} " /junit* .xml; do
177+ [ -f " $f " ] && mv " $f " " ${f% .xml} _main.xml"
178+ done
179+
180+ # Pass 2: Run only volume-expand tests with flake retries to tolerate
181+ # transient defragsvc contention on Windows (StorageWMI error 4).
182+ loudecho " Running volume-expand tests (with flake retries)"
183+ run_kubetest2 " e2e-kubernetes-volume-expand" \
184+ " ${GINKGO_SKIP} " \
185+ " ${GINKGO_FOCUS} .*(${WINDOWS_VOLUME_EXPAND_REGEX} )" \
186+ " --flake-attempts=2"
187+ VOLUME_EXPAND_PASSED=$?
188+
189+ if [[ ${VOLUME_EXPAND_PASSED} -ne 0 ]]; then
190+ loudecho " WARNING: Volume expansion tests failed."
191+ TEST_PASSED=1
192+ fi
193+ else
194+ run_kubetest2 " e2e-kubernetes" " ${GINKGO_SKIP} " " ${GINKGO_FOCUS} "
195+ TEST_PASSED=$?
196+ fi
151197 set -e
152198 set +x
153199 popd
0 commit comments