Skip to content

Commit c5a02b3

Browse files
authored
Merge pull request #1526 from LiZhenCheng9527/e2e-clean
Remove unnecessary images in e2e test
2 parents 9d6febf + 3097c3e commit c5a02b3

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ docker.push: docker
213213

214214
.PHONY: e2e
215215
e2e:
216-
./test/e2e/run_test.sh
216+
./test/e2e/run_test.sh --build-image-clean
217217

218218
.PHONY: e2e-ipv6
219219
e2e-ipv6:

test/e2e/run_test.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ while (("$#")); do
371371
PARAMS+=("-istio.test.nocleanup")
372372
shift
373373
;;
374+
--build-image-clean)
375+
BUILD_IMAGE_CLEAN=true
376+
shift
377+
;;
378+
--debug)
379+
DEBUG=true
380+
shift
381+
;;
374382
*)
375383
PARAMS+=("$1")
376384
shift
@@ -394,6 +402,11 @@ if [[ -z ${SKIP_BUILD:-} ]]; then
394402
install_kmeshctl
395403
fi
396404

405+
if [[ ${BUILD_IMAGE_CLEAN:-false} == "true" ]]; then
406+
echo "Cleaning up build image: ghcr.io/kmesh-net/kmesh-build:latest"
407+
docker image rm -f ghcr.io/kmesh-net/kmesh-build:latest 2>/dev/null || true
408+
fi
409+
397410
kubectl config use-context "kind-$NAME"
398411
echo "Running tests in cluster '$NAME'"
399412

@@ -403,9 +416,10 @@ if [[ -z ${SKIP_SETUP:-} ]]; then
403416
setup_kmesh
404417
fi
405418

406-
setup_kmesh_log
407-
408-
capture_pod_logs &
419+
if [[ ${DEBUG:-false} == "true" ]]; then
420+
setup_kmesh_log
421+
capture_pod_logs &
422+
fi
409423

410424
cmd="go test -v -tags=integ $ROOT_DIR/test/e2e/... -istio.test.kube.loadbalancer=false ${PARAMS[*]}"
411425

@@ -418,7 +432,7 @@ if [ $EXIT_CODE -ne 0 ]; then
418432
cat $LOGFILE
419433
fi
420434

421-
rm $LOGFILE
435+
rm rf $LOGFILE
422436

423437
if [[ -n ${CLEANUP_KIND} ]]; then
424438
cleanup_kind_cluster

0 commit comments

Comments
 (0)