Skip to content

Commit 0fafc66

Browse files
committed
prow.sh: skip sanity testing if component doesn't support it
Whether a component supports sanity testing depends on the component. For example, csi-driver-host-path enables it because it makes sense there (and only there). Letting the prow.sh script decide whether it actually runs simplifies the job definitions in test-infra.
1 parent 0b10f6a commit 0fafc66

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

prow.sh

+15-7
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,13 @@ configvar CSI_PROW_SANITY_CONTAINER "hostpath" "Kubernetes container with CSI dr
198198
# - serial, only alpha features
199199
# - sanity
200200
#
201-
# Sanity testing with csi-sanity only covers the CSI driver itself and thus
202-
# is off by default. A CSI driver can change that default in its .prow.sh
203-
# by setting CSI_PROW_TESTS_SANITY.
204-
configvar CSI_PROW_TESTS "unit parallel serial parallel-alpha serial-alpha ${CSI_PROW_TESTS_SANITY}" "tests to run"
201+
# Unknown or unsupported entries are ignored.
202+
#
203+
# Sanity testing with csi-sanity only covers the CSI driver itself and
204+
# thus only makes sense in repos which provide their own CSI
205+
# driver. Repos can enable sanity testing by setting
206+
# CSI_PROW_TESTS_SANITY=sanity.
207+
configvar CSI_PROW_TESTS "unit parallel serial parallel-alpha serial-alpha sanity" "tests to run"
205208
tests_enabled () {
206209
local t1 t2
207210
# We want word-splitting here, so ignore: Quote to prevent word splitting, or split robustly with mapfile or read -a.
@@ -216,11 +219,16 @@ tests_enabled () {
216219
done
217220
return 1
218221
}
222+
sanity_enabled () {
223+
[ "${CSI_PROW_TESTS_SANITY}" = "sanity" ] && tests_enabled "sanity"
224+
}
219225
tests_need_kind () {
220-
tests_enabled "sanity" "parallel" "serial" "serial-alpha" "parallel-alpha"
226+
tests_enabled "parallel" "serial" "serial-alpha" "parallel-alpha" ||
227+
sanity_enabled
221228
}
222229
tests_need_non_alpha_cluster () {
223-
tests_enabled "sanity" "parallel" "serial"
230+
tests_enabled "parallel" "serial" ||
231+
sanity_enabled
224232
}
225233
tests_need_alpha_cluster () {
226234
tests_enabled "parallel-alpha" "serial-alpha"
@@ -916,7 +924,7 @@ main () {
916924
if install_hostpath "$images"; then
917925
collect_cluster_info
918926
919-
if tests_enabled "sanity"; then
927+
if sanity_enabled; then
920928
if ! run_sanity; then
921929
ret=1
922930
fi

0 commit comments

Comments
 (0)