diff --git a/experiment/compatibility-versions/e2e-skip-version-testing.sh b/experiment/compatibility-versions/e2e-skip-version-testing.sh index 88f0e78e8578..36060605d84c 100755 --- a/experiment/compatibility-versions/e2e-skip-version-testing.sh +++ b/experiment/compatibility-versions/e2e-skip-version-testing.sh @@ -32,9 +32,39 @@ signal_handler() { } trap signal_handler INT TERM +skip_min_kubelet_versions() { + local major_version=$1 + local minor_version_min=$2 + local minor_version_max=$3 + local start_minor + + if [[ minor_version_min -gt minor_version_max ]]; then + return + fi + + local skips=() + for (( ver=minor_version_min; ver<=minor_version_max; ver++ )); do + skips+=("\[MinimumKubeletVersion:${major_version}\.${ver}\]") + done + + local skip_regex + skip_regex=$(IFS='|'; echo "${skips[*]}") + echo "skip kubelet tests with ${skip_regex}" + + if [[ -z "${skip_regex}" ]]; then + return + fi + + if [ -n "${SKIP:-}" ]; then + export SKIP="${SKIP}|${skip_regex}" + else + export SKIP="${skip_regex}" + fi + echo "SKIP=${SKIP}" +} + run_skip_version_tests() { export PARALLEL=true - initial_emulated_version="$EMULATED_VERSION" ret=0 while ! version_gte "$EMULATED_VERSION" "$CURRENT_VERSION"; do echo "Running e2e with compatibility version set to ${EMULATED_VERSION}" @@ -50,11 +80,6 @@ run_skip_version_tests() { return 1 fi pushd "${PREV_RELEASE_REPO_PATH}" - if [[ "$EMULATED_VERSION" != "$initial_emulated_version" ]]; then - # overwrite node e2e tests with the node tests at the initial emulated version because Kubelet is still at that version. - echo "Replace ${EMULATED_VERSION} node tests with node tests at ${initial_emulated_version}" - rsync -av --delete "./test/e2e/node" "${TMP_DIR}/prev-release-k8s-${initial_emulated_version}/test/e2e/node" - fi build_test_bins "${PREV_RELEASE_BRANCH}" || ret=$? run_e2e_tests || ret=$? if [[ "$ret" -ne 0 ]]; then @@ -72,11 +97,6 @@ run_skip_version_tests() { # Test removal of emulated version entirely. export PREV_RELEASE_BRANCH="release-${EMULATED_VERSION}" delete_emulation_version || ret=$? - if [[ "$EMULATED_VERSION" != "$initial_emulated_version" ]]; then - # overwrite node e2e tests with the node tests at the initial emulated version because Kubelet is still at that version. - echo "Replace ${EMULATED_VERSION} node tests with node tests at ${initial_emulated_version}" - rsync -av --delete "./test/e2e/node" "${TMP_DIR}/prev-release-k8s-${initial_emulated_version}/test/e2e/node" - fi build_test_bins "${PREV_RELEASE_BRANCH}" || ret=$? run_e2e_tests || ret=$? return $ret @@ -109,6 +129,7 @@ main() { export CURRENT_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}" export PREV_VERSION="${MAJOR_VERSION}.$((MINOR_VERSION - VERSION_DELTA))" export EMULATED_VERSION="${PREV_VERSION}" + skip_min_kubelet_versions $MAJOR_VERSION $((MINOR_VERSION - VERSION_DELTA + 1)) $MINOR_VERSION # export the KUBECONFIG to a unique path for testing KUBECONFIG="${HOME}/.kube/kind-test-config"