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

Enable cleanup in e2e #649

Merged
merged 1 commit into from
Jul 30, 2024
Merged
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
28 changes: 28 additions & 0 deletions test/e2e/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,21 @@ function install_dependencies() {
rm -rf istio-${ISTIO_VERSION}
}

function cleanup_kind_cluster() {
local NAME="${1:-kmesh-testing}"
echo "Deleting KinD cluster with name=${NAME}"
kind delete cluster --name="${NAME}"
echo "KinD cluster ${NAME} cleaned up"
}

function cleanup_docker_registry() {
echo "Stopping Docker registry named '${KIND_REGISTRY_NAME}'..."
docker stop "${KIND_REGISTRY_NAME}" || echo "Failed to stop or no such registry '${KIND_REGISTRY_NAME}'."

echo "Removing Docker registry named '${KIND_REGISTRY_NAME}'..."
docker rm "${KIND_REGISTRY_NAME}" || echo "Failed to remove or no such registry '${KIND_REGISTRY_NAME}'."
}

PARAMS=""

while (( "$#" )); do
Expand All @@ -210,6 +225,11 @@ while (( "$#" )); do
IPV6=true
shift
;;
--cleanup)
CLEANUP_KIND=true
CLEANUP_REGISTRY=true
shift
;;
--select-cases)
PARAMS+="-test.run \"$2\""
shift 2
Expand Down Expand Up @@ -243,3 +263,11 @@ fi
cmd="go test -v -tags=integ $ROOT_DIR/test/e2e/... -count=1 $PARAMS"

bash -c "$cmd"

if [[ -n "${CLEANUP_KIND}" ]]; then
cleanup_kind_cluster
fi

if [[ -n "${CLEANUP_REGISTRY}" ]]; then
cleanup_docker_registry
fi
Loading