Skip to content

Commit c07740b

Browse files
[compatibility]Add skip_min_kubelet_versions
Signed-off-by: Siyuan Zhang <[email protected]>
1 parent 5e950f0 commit c07740b

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

experiment/compatibility-versions/e2e-skip-version-testing.sh

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,39 @@ signal_handler() {
3232
}
3333
trap signal_handler INT TERM
3434

35+
skip_min_kubelet_versions() {
36+
local major_version=$1
37+
local minor_version_min=$2
38+
local minor_version_max=$3
39+
local start_minor
40+
41+
if [[ minor_version_min -gt minor_version_max ]]; then
42+
return
43+
fi
44+
45+
local skips=()
46+
for (( ver=minor_version_min; ver<=minor_version_max; ver++ )); do
47+
skips+=("\[MinimumKubeletVersion:${major_version}\.${ver}\]")
48+
done
49+
50+
local skip_regex
51+
skip_regex=$(IFS='|'; echo "${skips[*]}")
52+
echo "skip kubelet tests with ${skip_regex}"
53+
54+
if [[ -z "${skip_regex}" ]]; then
55+
return
56+
fi
57+
58+
if [ -n "${SKIP:-}" ]; then
59+
export SKIP="${SKIP}|${skip_regex}"
60+
else
61+
export SKIP="${skip_regex}"
62+
fi
63+
echo "SKIP=${SKIP}"
64+
}
65+
3566
run_skip_version_tests() {
3667
export PARALLEL=true
37-
initial_emulated_version="$EMULATED_VERSION"
3868
ret=0
3969
while ! version_gte "$EMULATED_VERSION" "$CURRENT_VERSION"; do
4070
echo "Running e2e with compatibility version set to ${EMULATED_VERSION}"
@@ -50,11 +80,6 @@ run_skip_version_tests() {
5080
return 1
5181
fi
5282
pushd "${PREV_RELEASE_REPO_PATH}"
53-
if [[ "$EMULATED_VERSION" != "$initial_emulated_version" ]]; then
54-
# overwrite node e2e tests with the node tests at the initial emulated version because Kubelet is still at that version.
55-
echo "Replace ${EMULATED_VERSION} node tests with node tests at ${initial_emulated_version}"
56-
rsync -av --delete "./test/e2e/node" "${TMP_DIR}/prev-release-k8s-${initial_emulated_version}/test/e2e/node"
57-
fi
5883
build_test_bins "${PREV_RELEASE_BRANCH}" || ret=$?
5984
run_e2e_tests || ret=$?
6085
if [[ "$ret" -ne 0 ]]; then
@@ -72,11 +97,6 @@ run_skip_version_tests() {
7297
# Test removal of emulated version entirely.
7398
export PREV_RELEASE_BRANCH="release-${EMULATED_VERSION}"
7499
delete_emulation_version || ret=$?
75-
if [[ "$EMULATED_VERSION" != "$initial_emulated_version" ]]; then
76-
# overwrite node e2e tests with the node tests at the initial emulated version because Kubelet is still at that version.
77-
echo "Replace ${EMULATED_VERSION} node tests with node tests at ${initial_emulated_version}"
78-
rsync -av --delete "./test/e2e/node" "${TMP_DIR}/prev-release-k8s-${initial_emulated_version}/test/e2e/node"
79-
fi
80100
build_test_bins "${PREV_RELEASE_BRANCH}" || ret=$?
81101
run_e2e_tests || ret=$?
82102
return $ret
@@ -109,6 +129,7 @@ main() {
109129
export CURRENT_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}"
110130
export PREV_VERSION="${MAJOR_VERSION}.$((MINOR_VERSION - VERSION_DELTA))"
111131
export EMULATED_VERSION="${PREV_VERSION}"
132+
skip_min_kubelet_versions $MAJOR_VERSION $((MINOR_VERSION - VERSION_DELTA + 1)) $MINOR_VERSION
112133

113134
# export the KUBECONFIG to a unique path for testing
114135
KUBECONFIG="${HOME}/.kube/kind-test-config"

0 commit comments

Comments
 (0)