Skip to content

Commit 5f08f0c

Browse files
committed
Squashed 'release-tools/' changes from 6616a6b..7b96bea
kubernetes-csi/csi-release-tools@7b96bea Merge kubernetes-csi/csi-release-tools#148 from dobsonj/add-checkpathcmd-to-prow kubernetes-csi/csi-release-tools@2d2e03b prow.sh: enable -csi.checkpathcmd option in csi-sanity kubernetes-csi/csi-release-tools@09d4151 Merge kubernetes-csi/csi-release-tools#147 from pohly/mock-testing kubernetes-csi/csi-release-tools@74cfbc9 prow.sh: support mock tests kubernetes-csi/csi-release-tools@4a3f110 prow.sh: remove obsolete test suppression git-subtree-dir: release-tools git-subtree-split: 7b96bea
1 parent ea17833 commit 5f08f0c

File tree

1 file changed

+68
-11
lines changed

1 file changed

+68
-11
lines changed

prow.sh

+68-11
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,17 @@ tests_need_alpha_cluster () {
296296
tests_enabled "parallel-alpha" "serial-alpha"
297297
}
298298

299+
# Enabling mock tests adds the "CSI mock volume" tests from https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/csi_mock_volume.go
300+
# to the e2e.test invocations (serial, parallel, and the corresponding alpha variants).
301+
# When testing canary images, those get used instead of the images specified
302+
# in the e2e.test's normal YAML files.
303+
#
304+
# The default is to enable this for all jobs which use canary images
305+
# because we want to know whether our release candidates will pass all
306+
# existing tests (the storage testsuites and mock testing in
307+
# Kubernetes).
308+
configvar CSI_PROW_E2E_MOCK "$(if [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then echo true; else echo false; fi)" "enable CSI mock volume tests"
309+
299310
# Regex for non-alpha, feature-tagged tests that should be run.
300311
#
301312
configvar CSI_PROW_E2E_FOCUS_LATEST '\[Feature:VolumeSnapshotDataSource\]' "non-alpha, feature-tagged tests for latest Kubernetes version"
@@ -354,11 +365,7 @@ configvar CSI_SNAPSHOTTER_VERSION "$(default_csi_snapshotter_version)" "external
354365
# whether they can run with the current cluster provider, but until
355366
# they are, we filter them out by name. Like the other test selection
356367
# variables, this is again a space separated list of regular expressions.
357-
#
358-
# "different node" test skips can be removed once
359-
# https://github.com/kubernetes/kubernetes/pull/82678 has been backported
360-
# to all the K8s versions we test against
361-
configvar CSI_PROW_E2E_SKIP 'Disruptive|different\s+node' "tests that need to be skipped"
368+
configvar CSI_PROW_E2E_SKIP 'Disruptive' "tests that need to be skipped"
362369

363370
# This creates directories that are required for testing.
364371
ensure_paths () {
@@ -877,6 +884,29 @@ start_loggers () {
877884
done
878885
}
879886
887+
# Patches the image versions of test/e2e/testing-manifests/storage-csi/mock in the k/k
888+
# source code, if needed.
889+
patch_kubernetes () {
890+
local source="$1" target="$2"
891+
892+
if [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then
893+
# We cannot replace k8s.gcr.io/sig-storage with gcr.io/k8s-staging-sig-storage because
894+
# e2e.test does not support it (see test/utils/image/manifest.go). Instead we
895+
# invoke the e2e.test binary with KUBE_TEST_REPO_LIST set to a file that
896+
# overrides that registry.
897+
find "$source/test/e2e/testing-manifests/storage-csi/mock" -name '*.yaml' -print0 | xargs -0 sed -i -e 's;k8s.gcr.io/sig-storage/\(.*\):v.*;k8s.gcr.io/sig-storage/\1:canary;'
898+
cat >"$target/e2e-repo-list" <<EOF
899+
sigStorageRegistry: gcr.io/k8s-staging-sig-storage
900+
EOF
901+
cat >&2 <<EOF
902+
903+
Using a modified version of k/k/test/e2e:
904+
$(cd "$source" && git diff 2>&1)
905+
906+
EOF
907+
fi
908+
}
909+
880910
# Makes the E2E test suite binary available as "${CSI_PROW_WORK}/e2e.test".
881911
install_e2e () {
882912
if [ -e "${CSI_PROW_WORK}/e2e.test" ]; then
@@ -885,6 +915,7 @@ install_e2e () {
885915
886916
git_checkout "${CSI_PROW_E2E_REPO}" "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_E2E_VERSION}" --depth=1 &&
887917
if [ "${CSI_PROW_E2E_IMPORT_PATH}" = "k8s.io/kubernetes" ]; then
918+
patch_kubernetes "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_WORK}" &&
888919
go_version="${CSI_PROW_GO_VERSION_E2E:-$(go_version_for_kubernetes "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_E2E_VERSION}")}" &&
889920
run_with_go "$go_version" make WHAT=test/e2e/e2e.test "-C${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
890921
ln -s "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}/_output/bin/e2e.test" "${CSI_PROW_WORK}"
@@ -936,7 +967,7 @@ run_e2e () (
936967
trap move_junit EXIT
937968
938969
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
939-
run_with_loggers ginkgo -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" -storage.testdriver="${CSI_PROW_WORK}/test-driver.yaml"
970+
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 -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" -storage.testdriver="${CSI_PROW_WORK}/test-driver.yaml"
940971
)
941972
942973
# Run csi-sanity against installed CSI driver.
@@ -975,6 +1006,24 @@ if ! kubectl exec "${CSI_PROW_SANITY_POD}" -c "${CSI_PROW_SANITY_CONTAINER}" --
9751006
exit 1
9761007
fi
9771008
EOF
1009+
1010+
cat >"${CSI_PROW_WORK}/checkdir_in_pod.sh" <<EOF
1011+
#!/bin/sh
1012+
CHECK_PATH=\$(cat <<SCRIPT
1013+
if [ -f "\$@" ]; then
1014+
echo "file"
1015+
elif [ -d "\$@" ]; then
1016+
echo "directory"
1017+
elif [ -e "\$@" ]; then
1018+
echo "other"
1019+
else
1020+
echo "not_found"
1021+
fi
1022+
SCRIPT
1023+
)
1024+
kubectl exec "${CSI_PROW_SANITY_POD}" -c "${CSI_PROW_SANITY_CONTAINER}" -- /bin/sh -c "\${CHECK_PATH}"
1025+
EOF
1026+
9781027
chmod u+x "${CSI_PROW_WORK}"/*dir_in_pod.sh
9791028
9801029
# This cannot run in parallel, because -csi.junitfile output
@@ -990,6 +1039,7 @@ EOF
9901039
-csi.createmountpathcmd "${CSI_PROW_WORK}/mkdir_in_pod.sh" \
9911040
-csi.removestagingpathcmd "${CSI_PROW_WORK}/rmdir_in_pod.sh" \
9921041
-csi.removemountpathcmd "${CSI_PROW_WORK}/rmdir_in_pod.sh" \
1042+
-csi.checkpathcmd "${CSI_PROW_WORK}/checkdir_in_pod.sh" \
9931043
)
9941044
9951045
ascii_to_xml () {
@@ -1167,13 +1217,20 @@ main () {
11671217
done
11681218
fi
11691219
1220+
# Run the external driver tests and optionally also mock tests.
1221+
local focus="External.Storage"
1222+
if "$CSI_PROW_E2E_MOCK"; then
1223+
focus="($focus|CSI.mock.volume)"
1224+
fi
1225+
11701226
if tests_need_non_alpha_cluster; then
11711227
start_cluster || die "starting the non-alpha cluster failed"
11721228
11731229
# Install necessary snapshot CRDs and snapshot controller
11741230
install_snapshot_crds
11751231
install_snapshot_controller
11761232
1233+
11771234
# Installing the driver might be disabled.
11781235
if ${CSI_PROW_DRIVER_INSTALL} "$images"; then
11791236
collect_cluster_info
@@ -1188,7 +1245,7 @@ main () {
11881245
# Ignore: Double quote to prevent globbing and word splitting.
11891246
# shellcheck disable=SC2086
11901247
if ! run_e2e parallel ${CSI_PROW_GINKO_PARALLEL} \
1191-
-focus="External.Storage" \
1248+
-focus="$focus" \
11921249
-skip="$(regex_join "${CSI_PROW_E2E_SERIAL}" "${CSI_PROW_E2E_ALPHA}" "${CSI_PROW_E2E_SKIP}")"; then
11931250
warn "E2E parallel failed"
11941251
ret=1
@@ -1198,7 +1255,7 @@ main () {
11981255
# Ignore: Double quote to prevent globbing and word splitting.
11991256
# shellcheck disable=SC2086
12001257
if ! run_e2e parallel-features ${CSI_PROW_GINKO_PARALLEL} \
1201-
-focus="External.Storage.*($(regex_join "${CSI_PROW_E2E_FOCUS}"))" \
1258+
-focus="$focus.*($(regex_join "${CSI_PROW_E2E_FOCUS}"))" \
12021259
-skip="$(regex_join "${CSI_PROW_E2E_SERIAL}")"; then
12031260
warn "E2E parallel features failed"
12041261
ret=1
@@ -1207,7 +1264,7 @@ main () {
12071264
12081265
if tests_enabled "serial"; then
12091266
if ! run_e2e serial \
1210-
-focus="External.Storage.*($(regex_join "${CSI_PROW_E2E_SERIAL}"))" \
1267+
-focus="$focus.*($(regex_join "${CSI_PROW_E2E_SERIAL}"))" \
12111268
-skip="$(regex_join "${CSI_PROW_E2E_ALPHA}" "${CSI_PROW_E2E_SKIP}")"; then
12121269
warn "E2E serial failed"
12131270
ret=1
@@ -1233,7 +1290,7 @@ main () {
12331290
# Ignore: Double quote to prevent globbing and word splitting.
12341291
# shellcheck disable=SC2086
12351292
if ! run_e2e parallel-alpha ${CSI_PROW_GINKO_PARALLEL} \
1236-
-focus="External.Storage.*($(regex_join "${CSI_PROW_E2E_ALPHA}"))" \
1293+
-focus="$focus.*($(regex_join "${CSI_PROW_E2E_ALPHA}"))" \
12371294
-skip="$(regex_join "${CSI_PROW_E2E_SERIAL}" "${CSI_PROW_E2E_SKIP}")"; then
12381295
warn "E2E parallel alpha failed"
12391296
ret=1
@@ -1242,7 +1299,7 @@ main () {
12421299
12431300
if tests_enabled "serial-alpha"; then
12441301
if ! run_e2e serial-alpha \
1245-
-focus="External.Storage.*(($(regex_join "${CSI_PROW_E2E_SERIAL}")).*($(regex_join "${CSI_PROW_E2E_ALPHA}"))|($(regex_join "${CSI_PROW_E2E_ALPHA}")).*($(regex_join "${CSI_PROW_E2E_SERIAL}")))" \
1302+
-focus="$focus.*(($(regex_join "${CSI_PROW_E2E_SERIAL}")).*($(regex_join "${CSI_PROW_E2E_ALPHA}"))|($(regex_join "${CSI_PROW_E2E_ALPHA}")).*($(regex_join "${CSI_PROW_E2E_SERIAL}")))" \
12461303
-skip="$(regex_join "${CSI_PROW_E2E_SKIP}")"; then
12471304
warn "E2E serial alpha failed"
12481305
ret=1

0 commit comments

Comments
 (0)