Skip to content

Commit deff7e4

Browse files
committed
Changes to csi prow to run e2e tests in sidecars
1 parent d24254f commit deff7e4

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

prow.sh

Lines changed: 32 additions & 4 deletions
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,10 @@ 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+
355367
# Which external-snapshotter tag to use for the snapshotter CRD and snapshot-controller deployment
356368
default_csi_snapshotter_version () {
357369
if [ "${CSI_PROW_KUBERNETES_VERSION}" = "latest" ] || [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then
@@ -942,6 +954,9 @@ install_e2e () {
942954
return
943955
fi
944956
957+
if sidecar_tests_enabled; then
958+
run_with_go "${CSI_PROW_GO_VERSION_BUILD}" go test -c -o "${CSI_PROW_WORK}/e2e-local.test" "${CSI_PROW_SIDECAR_E2E_IMPORT_PATH}"
959+
fi
945960
git_checkout "${CSI_PROW_E2E_REPO}" "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_E2E_VERSION}" --depth=1 &&
946961
if [ "${CSI_PROW_E2E_IMPORT_PATH}" = "k8s.io/kubernetes" ]; then
947962
patch_kubernetes "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" "${CSI_PROW_WORK}" &&
@@ -997,8 +1012,13 @@ run_e2e () (
9971012
}
9981013
trap move_junit EXIT
9991014
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"
1015+
if [ "${name}" == "local" ]; then
1016+
cd "${GOPATH}/src/${CSI_PROW_SIDECAR_E2E_IMPORT_PATH}" &&
1017+
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
1018+
else
1019+
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
1020+
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"
1021+
fi
10021022
)
10031023
10041024
# Run csi-sanity against installed CSI driver.
@@ -1310,6 +1330,14 @@ main () {
13101330
ret=1
13111331
fi
13121332
fi
1333+
1334+
if sidecar_tests_enabled; then
1335+
if ! run_e2e local \
1336+
-focus="${CSI_PROW_SIDECAR_E2E_FOCUS}"; then
1337+
warn "E2E sidecar failed"
1338+
ret=1
1339+
fi
1340+
fi
13131341
fi
13141342
delete_cluster_inside_prow_job non-alpha
13151343
fi

0 commit comments

Comments
 (0)