Skip to content

Commit db8abb6

Browse files
authored
Merge pull request kubernetes-csi#20 from pohly/test-driver-config
more flexible test driver config
2 parents 0399988 + b2f4e05 commit db8abb6

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

prow.sh

+26-18
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
154154
configvar CSI_PROW_HOSTPATH_VERSION fc52d13ba07922c80555a24616a5b16480350c3f "hostpath driver" # pre-1.1.0
155155
configvar CSI_PROW_HOSTPATH_REPO https://github.com/kubernetes-csi/csi-driver-host-path "hostpath repo"
156156
configvar CSI_PROW_DEPLOYMENT "" "deployment"
157+
configvar CSI_PROW_HOSTPATH_DRIVER_NAME "csi-hostpath" "the driver (aka provisioner) name of the chosen hostpath driver"
157158

158159
# If CSI_PROW_HOSTPATH_CANARY is set (typically to "canary", but also
159160
# "1.0-canary"), then all image versions are replaced with that
@@ -673,6 +674,29 @@ hostpath_supports_block () {
673674
echo "${result:-true}"
674675
}
675676
677+
# The default implementation of this function generates a external
678+
# driver test configuration for the hostpath driver.
679+
#
680+
# The content depends on both what the E2E suite expects and what the
681+
# installed hostpath driver supports. Generating it here seems prone
682+
# to breakage, but it is uncertain where a better place might be.
683+
generate_test_driver () {
684+
cat <<EOF
685+
ShortName: csiprow
686+
StorageClass:
687+
FromName: true
688+
SnapshotClass:
689+
FromName: true
690+
DriverInfo:
691+
Name: ${CSI_PROW_HOSTPATH_DRIVER_NAME}
692+
Capabilities:
693+
block: $(hostpath_supports_block)
694+
persistence: true
695+
dataSource: true
696+
multipods: true
697+
EOF
698+
}
699+
676700
# Captures pod output while running some other command.
677701
run_with_loggers () (
678702
loggers=$(start_loggers -f)
@@ -698,23 +722,7 @@ run_e2e () (
698722
# When running on a multi-node cluster, we need to figure out where the
699723
# hostpath driver was deployed and set ClientNodeName accordingly.
700724
701-
# The content of this file depends on both what the E2E suite expects and
702-
# what the installed hostpath driver supports. Generating it here seems
703-
# prone to breakage, but it is uncertain where a better place might be.
704-
cat >"${CSI_PROW_WORK}/hostpath-test-driver.yaml" <<EOF
705-
ShortName: csiprow
706-
StorageClass:
707-
FromName: true
708-
SnapshotClass:
709-
FromName: true
710-
DriverInfo:
711-
Name: csi-hostpath
712-
Capabilities:
713-
block: $(hostpath_supports_block)
714-
persistence: true
715-
dataSource: true
716-
multipods: true
717-
EOF
725+
generate_test_driver >"${CSI_PROW_WORK}/test-driver.yaml" || die "generating test-driver.yaml failed"
718726
719727
# Rename, merge and filter JUnit files. Necessary in case that we run the E2E suite again
720728
# and to avoid the large number of "skipped" tests that we get from using
@@ -727,7 +735,7 @@ EOF
727735
trap move_junit EXIT
728736
729737
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
730-
run_with_loggers ginkgo -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" -storage.testdriver="${CSI_PROW_WORK}/hostpath-test-driver.yaml"
738+
run_with_loggers ginkgo -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" -storage.testdriver="${CSI_PROW_WORK}/test-driver.yaml"
731739
)
732740
733741
# Run csi-sanity against installed CSI driver.

0 commit comments

Comments
 (0)