Skip to content

Commit 1efc272

Browse files
authored
Merge pull request #206 from RaunakShah/update-prow
Changes to csi prow to run e2e tests in sidecars
2 parents cfa5a75 + 7d410d8 commit 1efc272

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

prow.sh

+34-4
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ configvar CSI_PROW_E2E_VERSION "$(version_to_git "${CSI_PROW_KUBERNETES_VERSION}
228228
configvar CSI_PROW_E2E_REPO "https://github.com/kubernetes/kubernetes" "E2E repo"
229229
configvar CSI_PROW_E2E_IMPORT_PATH "k8s.io/kubernetes" "E2E package"
230230

231+
# Local path for e2e tests. Set to "none" to disable.
232+
configvar CSI_PROW_SIDECAR_E2E_IMPORT_PATH "none" "CSI Sidecar E2E package"
233+
231234
# csi-sanity testing from the csi-test repo can be run against the installed
232235
# CSI driver. For this to work, deploying the driver must expose the Unix domain
233236
# csi.sock as a TCP service for use by the csi-sanity command, which runs outside
@@ -282,13 +285,18 @@ tests_enabled () {
282285
sanity_enabled () {
283286
[ "${CSI_PROW_TESTS_SANITY}" = "sanity" ] && tests_enabled "sanity"
284287
}
288+
289+
sidecar_tests_enabled () {
290+
[ "${CSI_PROW_SIDECAR_E2E_IMPORT_PATH}" != "none" ]
291+
}
292+
285293
tests_need_kind () {
286294
tests_enabled "parallel" "serial" "serial-alpha" "parallel-alpha" ||
287-
sanity_enabled
295+
sanity_enabled || sidecar_tests_enabled
288296
}
289297
tests_need_non_alpha_cluster () {
290298
tests_enabled "parallel" "serial" ||
291-
sanity_enabled
299+
sanity_enabled || sidecar_tests_enabled
292300
}
293301
tests_need_alpha_cluster () {
294302
tests_enabled "parallel-alpha" "serial-alpha"
@@ -352,6 +360,11 @@ configvar CSI_PROW_E2E_ALPHA_GATES "$(get_versioned_variable CSI_PROW_E2E_ALPHA_
352360
configvar CSI_PROW_E2E_GATES_LATEST '' "non alpha feature gates for latest Kubernetes"
353361
configvar CSI_PROW_E2E_GATES "$(get_versioned_variable CSI_PROW_E2E_GATES "${csi_prow_kubernetes_version_suffix}")" "non alpha E2E feature gates"
354362

363+
# Focus for local tests run in the sidecar E2E repo. Only used if CSI_PROW_SIDECAR_E2E_IMPORT_PATH
364+
# is not set to "none". If empty, all tests in the sidecar repo will be run.
365+
configvar CSI_PROW_SIDECAR_E2E_FOCUS '' "tags for local E2E tests"
366+
configvar CSI_PROW_SIDECAR_E2E_SKIP '' "local tests that need to be skipped"
367+
355368
# Which external-snapshotter tag to use for the snapshotter CRD and snapshot-controller deployment
356369
default_csi_snapshotter_version () {
357370
if [ "${CSI_PROW_KUBERNETES_VERSION}" = "latest" ] || [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then
@@ -942,6 +955,9 @@ install_e2e () {
942955
return
943956
fi
944957
958+
if sidecar_tests_enabled; then
959+
run_with_go "${CSI_PROW_GO_VERSION_BUILD}" go test -c -o "${CSI_PROW_WORK}/e2e-local.test" "${CSI_PROW_SIDECAR_E2E_IMPORT_PATH}"
960+
fi
945961
git_checkout "${CSI_PROW_E2E_REPO}" "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_E2E_VERSION}" --depth=1 &&
946962
if [ "${CSI_PROW_E2E_IMPORT_PATH}" = "k8s.io/kubernetes" ]; then
947963
patch_kubernetes "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_WORK}" &&
@@ -997,8 +1013,13 @@ run_e2e () (
9971013
}
9981014
trap move_junit EXIT
9991015
1000-
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
1001-
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"
1016+
if [ "${name}" == "local" ]; then
1017+
cd "${GOPATH}/src/${CSI_PROW_SIDECAR_E2E_IMPORT_PATH}" &&
1018+
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-local.test" -- -report-dir "${ARTIFACTS}" -report-prefix local
1019+
else
1020+
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
1021+
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"
1022+
fi
10021023
)
10031024
10041025
# Run csi-sanity against installed CSI driver.
@@ -1310,6 +1331,15 @@ main () {
13101331
ret=1
13111332
fi
13121333
fi
1334+
1335+
if sidecar_tests_enabled; then
1336+
if ! run_e2e local \
1337+
-focus="${CSI_PROW_SIDECAR_E2E_FOCUS}" \
1338+
-skip="$(regex_join "${CSI_PROW_E2E_SERIAL}")"; then
1339+
warn "E2E sidecar failed"
1340+
ret=1
1341+
fi
1342+
fi
13131343
fi
13141344
delete_cluster_inside_prow_job non-alpha
13151345
fi

0 commit comments

Comments
 (0)