Skip to content

Commit 6602d38

Browse files
committed
prow.sh: different E2E suite depending on Kubernetes version
Instead of always using the latest E2E tests for all Kubernetes versions, the plan now is to use the tests that match the Kubernetes version. However, for 1.13 we have to make an exception because the suite for that version did not support the necessary --storage.testdriver parameter.
1 parent 741319b commit 6602d38

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

prow.sh

+36-36
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ configvar () {
5252
eval echo "\$3:" "$1=\${$1}"
5353
}
5454

55+
# Prints the value of a variable + version suffix, falling back to variable + "LATEST".
56+
get_versioned_variable () {
57+
local var="$1"
58+
local version="$2"
59+
local value
60+
61+
eval value="\${${var}_${version}}"
62+
if ! [ "$value" ]; then
63+
eval value="\${${var}_LATEST}"
64+
fi
65+
echo "$value"
66+
}
67+
5568
# Go versions can be specified seperately for different tasks
5669
# If the pre-installed Go is missing or a different
5770
# version, the required version here will get installed
@@ -158,9 +171,15 @@ configvar CSI_PROW_HOSTPATH_CANARY "" "hostpath image"
158171
# all generated files are present.
159172
#
160173
# CSI_PROW_E2E_REPO=none disables E2E testing.
161-
configvar CSI_PROW_E2E_VERSION v1.14.0 "E2E version"
162-
configvar CSI_PROW_E2E_REPO https://github.com/kubernetes/kubernetes "E2E repo"
163-
configvar CSI_PROW_E2E_IMPORT_PATH k8s.io/kubernetes "E2E package"
174+
configvar CSI_PROW_E2E_VERSION_1_13 v1.14.0 "E2E version for Kubernetes 1.13.x" # we can't use the one from 1.13.x because it didn't have --storage.testdriver
175+
configvar CSI_PROW_E2E_VERSION_1_14 v1.14.0 "E2E version for Kubernetes 1.14.x"
176+
# TODO: add new CSI_PROW_E2E_VERSION entry for future Kubernetes releases
177+
configvar CSI_PROW_E2E_VERSION_LATEST master "E2E version for Kubernetes master" # testing against Kubernetes master is already tracking a moving target, so we might as well use a moving E2E version
178+
configvar CSI_PROW_E2E_REPO_LATEST https://github.com/kubernetes/kubernetes "E2E repo for Kubernetes >= 1.13.x" # currently the same for all versions
179+
configvar CSI_PROW_E2E_IMPORT_PATH_LATEST k8s.io/kubernetes "E2E package for Kubernetes >= 1.13.x" # currently the same for all versions
180+
configvar CSI_PROW_E2E_VERSION "$(get_versioned_variable CSI_PROW_E2E_VERSION "${csi_prow_kubernetes_version_suffix}")" "E2E version"
181+
configvar CSI_PROW_E2E_REPO "$(get_versioned_variable CSI_PROW_E2E_REPO "${csi_prow_kubernetes_version_suffix}")" "E2E repo"
182+
configvar CSI_PROW_E2E_IMPORT_PATH "$(get_versioned_variable CSI_PROW_E2E_IMPORT_PATH "${csi_prow_kubernetes_version_suffix}")" "E2E package"
164183

165184
# csi-sanity testing from the csi-test repo can be run against the installed
166185
# CSI driver. For this to work, deploying the driver must expose the Unix domain
@@ -200,42 +219,22 @@ regex_join () {
200219
echo "$@" | sed -e 's/ */|/g' -e 's/^|*//' -e 's/|*$//' -e 's/^$/this-matches-nothing/g'
201220
}
202221

203-
# Prints the value of a variable + version suffix, falling back to variable + "LATEST".
204-
get_versioned_variable () {
205-
local var="$1"
206-
local version="$2"
207-
local value
208-
209-
eval value="\${${var}_${version}}"
210-
if ! [ "$value" ]; then
211-
eval value="\${${var}_LATEST}"
212-
fi
213-
echo "$value"
214-
}
215-
216-
# Which tests are alpha depends on the Kubernetes version. The same
217-
# E2E test suite is used for all Kubernetes versions, including older
218-
# Kubernetes.
219-
#
220-
# Feature tags in the test are set based on what is an alpha
221-
# feature in the Kubernetes version that contains the E2E test suite's
222-
# source code.
222+
# Which tests are alpha depends on the Kubernetes version. We could
223+
# use the same E2E test for all Kubernetes version. This would have
224+
# the advantage that new tests can be applied to older versions
225+
# without having to backport tests.
223226
#
224-
# So when testing against an older Kubernetes release, some tests
225-
# might be enabled by default which don't pass for that older
226-
# Kubernetes version. In that case, the
227-
# CSI_PROW_E2E_ALPHA_<k8s-version> variable cannot just
228-
# be based on the `Feature` tag, it also must contain the names
229-
# of tests that used to be alpha but no longer have that tag.
227+
# But the feature tag gets removed from E2E tests when the corresponding
228+
# feature becomes beta, so we would have to track which tests were
229+
# alpha in previous Kubernetes releases. This was considered too
230+
# error prone. Therefore we use E2E tests that match the Kubernetes
231+
# version that is getting tested.
230232
#
231-
# <k8s-version> is just major+minor version separated by
232-
# underscore. "latest" matches master. It is also used for
233-
# unknown versions, so when master gets released there is
234-
# no need to add a new versioned variable. That only needs to be
235-
# done when updating something in the configuration that leads
236-
# to "latest" no longer being suitable.
233+
# However, for 1.13.x testing we have to use the E2E tests from 1.14
234+
# because 1.13 didn't have --storage.testdriver yet, so for that (and only
235+
# that version) we have to define alpha tests differently.
237236
configvar CSI_PROW_E2E_ALPHA_1_13 '\[Feature: \[Testpattern:.Dynamic.PV..block.volmode.\] should.create.and.delete.block.persistent.volumes' "alpha tests for Kubernetes 1.13" # Raw block was an alpha feature in 1.13.
238-
configvar CSI_PROW_E2E_ALPHA_LATEST '\[Feature:' "alpha tests for Kubernetes master"
237+
configvar CSI_PROW_E2E_ALPHA_LATEST '\[Feature:' "alpha tests for Kubernetes >= 1.14" # there's no need to update this, adding a new case for CSI_PROW_E2E for a new Kubernetes is enough
239238
configvar CSI_PROW_E2E_ALPHA "$(get_versioned_variable CSI_PROW_E2E_ALPHA "${csi_prow_kubernetes_version_suffix}")" "alpha tests"
240239

241240
# After the parallel E2E test without alpha features, a test cluster
@@ -251,6 +250,7 @@ configvar CSI_PROW_E2E_ALPHA "$(get_versioned_variable CSI_PROW_E2E_ALPHA "${csi
251250
# the failing test for "latest" or by updating the test and not running
252251
# it anymore for older releases.
253252
configvar CSI_PROW_E2E_ALPHA_GATES_1_13 'VolumeSnapshotDataSource=true,BlockVolume=true,CSIBlockVolume=true' "alpha feature gates for Kubernetes 1.13"
253+
# TODO: add new CSI_PROW_ALPHA_GATES entry for future Kubernetes releases
254254
configvar CSI_PROW_E2E_ALPHA_GATES_LATEST 'VolumeSnapshotDataSource=true' "alpha feature gates for latest Kubernetes"
255255
configvar CSI_PROW_E2E_ALPHA_GATES "$(get_versioned_variable CSI_PROW_E2E_ALPHA_GATES "${csi_prow_kubernetes_version_suffix}")" "alpha E2E feature gates"
256256

0 commit comments

Comments
 (0)