Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: add test for several control plane versions #676

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions test/environments/multiple.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
50 changes: 42 additions & 8 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
Loading