Skip to content

Commit 5416e55

Browse files
committed
Add flake retries for Windows volume expansion tests
Signed-off-by: Eddie Torres <torredil@amazon.com>
1 parent ef4b3ee commit 5416e55

File tree

1 file changed

+58
-10
lines changed

1 file changed

+58
-10
lines changed

hack/e2e/run.sh

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,64 @@ 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+
if [[ "${WINDOWS}" == true ]]; then
146+
# Pass 1: Run all tests except volume-expand
147+
loudecho "Running non-volume-expand tests (no retries)"
148+
PATH="${BIN}:${PATH}" "${BIN}/kubetest2" noop \
149+
--run-id="e2e-kubernetes" \
150+
--test=ginkgo \
151+
-- \
152+
--skip-regex="${GINKGO_SKIP}|${WINDOWS_VOLUME_EXPAND_REGEX}" \
153+
--focus-regex="${GINKGO_FOCUS}" \
154+
--test-package-version=$(curl -L https://dl.k8s.io/release/stable-${packageVersion}.txt) \
155+
--parallel=${GINKGO_PARALLEL} \
156+
--test-args="-storage.testdriver=${PWD}/manifests.yaml -kubeconfig=${KUBECONFIG} -node-os-distro=${NODE_OS_DISTRO}"
157+
TEST_PASSED=$?
158+
159+
# Preserve Pass 1 JUnit results before Pass 2 overwrites them.
160+
# kubetest2 writes JUnit XML to $ARTIFACTS (or ./_artifacts if unset).
161+
_JUNIT_DIR="${ARTIFACTS:-_artifacts}"
162+
for f in "${_JUNIT_DIR}"/junit*.xml; do
163+
[ -f "$f" ] && mv "$f" "${f%.xml}_main.xml"
164+
done
165+
166+
# Pass 2: Run only volume-expand tests with flake retries to tolerate
167+
# transient defragsvc contention on Windows (StorageWMI error 4).
168+
loudecho "Running volume-expand tests (with flake retries)"
169+
PATH="${BIN}:${PATH}" "${BIN}/kubetest2" noop \
170+
--run-id="e2e-kubernetes-volume-expand" \
171+
--test=ginkgo \
172+
-- \
173+
--skip-regex="${GINKGO_SKIP}" \
174+
--focus-regex="${GINKGO_FOCUS}.*(${WINDOWS_VOLUME_EXPAND_REGEX})" \
175+
--test-package-version=$(curl -L https://dl.k8s.io/release/stable-${packageVersion}.txt) \
176+
--parallel=${GINKGO_PARALLEL} \
177+
--ginkgo-args="--flake-attempts=2" \
178+
--test-args="-storage.testdriver=${PWD}/manifests.yaml -kubeconfig=${KUBECONFIG} -node-os-distro=${NODE_OS_DISTRO}"
179+
VOLUME_EXPAND_PASSED=$?
180+
181+
if [[ ${TEST_PASSED} -ne 0 || ${VOLUME_EXPAND_PASSED} -ne 0 ]]; then
182+
if [[ ${VOLUME_EXPAND_PASSED} -ne 0 ]]; then
183+
loudecho "WARNING: Volume expansion tests failed."
184+
fi
185+
TEST_PASSED=1
186+
fi
187+
else
188+
PATH="${BIN}:${PATH}" "${BIN}/kubetest2" noop \
189+
--run-id="e2e-kubernetes" \
190+
--test=ginkgo \
191+
-- \
192+
--skip-regex="${GINKGO_SKIP}" \
193+
--focus-regex="${GINKGO_FOCUS}" \
194+
--test-package-version=$(curl -L https://dl.k8s.io/release/stable-${packageVersion}.txt) \
195+
--parallel=${GINKGO_PARALLEL} \
196+
--test-args="-storage.testdriver=${PWD}/manifests.yaml -kubeconfig=${KUBECONFIG} -node-os-distro=${NODE_OS_DISTRO}"
197+
TEST_PASSED=$?
198+
fi
151199
set -e
152200
set +x
153201
popd

0 commit comments

Comments
 (0)