diff --git a/test/environments/multiple.env.sh b/test/environments/multiple.env.sh index 3b74ad68f..4865c9636 100755 --- a/test/environments/multiple.env.sh +++ b/test/environments/multiple.env.sh @@ -7,6 +7,8 @@ set -o pipefail # Create an environment that manages an multiple clusters of different versions cases="${1}" +control_plane_version="${2}" +control_plane_name="control-${control_plane_version//./-}" source "$(dirname "${BASH_SOURCE[0]}")/../helper.sh" @@ -33,11 +35,11 @@ function cleanup() { for release in "${releases[@]}"; do delete_data_plane "data-${release//./-}" >/dev/null 2>&1 done - delete_control_plane control-v1-30 >/dev/null 2>&1 + delete_control_plane ${control_plane_name} >/dev/null 2>&1 } trap cleanup EXIT -create_control_plane control-v1-30 v1.30.0 || { +create_control_plane ${control_plane_name} ${control_plane_version} || { echo "Failed to create control plane" exit 1 } diff --git a/test/environments/default.env.sh b/test/environments/single.env.sh similarity index 57% rename from test/environments/default.env.sh rename to test/environments/single.env.sh index f5499ba2d..895e565e6 100755 --- a/test/environments/default.env.sh +++ b/test/environments/single.env.sh @@ -7,21 +7,24 @@ set -o pipefail # Create an environment that manages a single cluster cases="${1}" +version="${2}" +control_plane_name="control-${version//./-}" +data_plane_name="data-${version//./-}" source "$(dirname "${BASH_SOURCE[0]}")/../helper.sh" function cleanup() { "${ROOT}/hack/clean-clusterconfigs.sh" >/dev/null 2>&1 - delete_data_plane data-v1-30 >/dev/null 2>&1 - delete_control_plane control-v1-30 >/dev/null 2>&1 + delete_data_plane ${data_plane_name} >/dev/null 2>&1 + delete_control_plane ${control_plane_name} >/dev/null 2>&1 } trap cleanup EXIT -create_control_plane control-v1-30 v1.30.0 || { +create_control_plane ${control_plane_name} ${version} || { echo "Failed to create control plane" exit 1 } -create_data_plane data-v1-30 v1.30.0 || { +create_data_plane ${data_plane_name} ${version} || { echo "Failed to create data plane" exit 1 } diff --git a/test/test.sh b/test/test.sh index 51867c520..8ce6c4ebc 100755 --- a/test/test.sh +++ b/test/test.sh @@ -4,6 +4,24 @@ TEST_ROOT="$(dirname "${BASH_SOURCE[0]}")" source "$(dirname "${BASH_SOURCE[0]}")/helper.sh" +single_versions=( + v1.30.0 + v1.23.17 + +# Since ubuntu in github action uses cgroup v2 by default +# and can't install clusters below 1.19, skip them for now! +# v1.18.20 +# v1.14.10 +) + +multiple_versions=( + v1.30.0 + +# Since ubuntu in github action uses cgroup v2 by default +# and can't install clusters below 1.19, skip them for now! +# v1.14.10 +) + function main() { local name local env_name @@ -17,18 +35,34 @@ function main() { build_image echo "::endgroup::" - for env in "${TEST_ROOT}"/environments/*.env.sh; do - [[ -e "${env}" ]] || continue - env_name="${env##*/}" - env_name="${env_name%.env.sh}" + for version in "${single_versions[@]}"; do + for file in "${TEST_ROOT}"/cases/*.test.sh; do + [[ -e "${file}" ]] || continue + name="${file##*/}" + name="${name%.test.sh}" + + echo "::group::Running [single cluster] test ${name} on ${version}" + if ! "${TEST_ROOT}/environments/single.env.sh" "${file}" "${version}"; then + failed+=("'${name} on ${version}'") + mv "${TEST_ROOT}/logs" "${TEST_ROOT}/logs-${name}-single-cluster-${version}" + else + # Clean up logs + rm -rf "${TEST_ROOT}/logs" + fi + echo "::endgroup::" + done + done + + for version in "${multi_versions[@]}"; do for file in "${TEST_ROOT}"/cases/*.test.sh; do [[ -e "${file}" ]] || continue name="${file##*/}" name="${name%.test.sh}" - echo "::group::Running test ${name} on ${env_name}" - if ! "${env}" "${file}"; then - failed+=("'${name} on ${env_name}'") - mv "${TEST_ROOT}/logs" "${TEST_ROOT}/logs-${name}-${env_name}" + + echo "::group::Running [multiple clusters] test ${name} on ${version}" + if ! "${TEST_ROOT}/environments/multiple.env.sh" "${file}" "${version}"; then + failed+=("'${name} on ${version}'") + mv "${TEST_ROOT}/logs" "${TEST_ROOT}/logs-${name}-multiple-clusters-${version}" else # Clean up logs rm -rf "${TEST_ROOT}/logs"