Skip to content

Commit a3d2f92

Browse files
add prometheus image pre load handle
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
1 parent b5184bc commit a3d2f92

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/e2e/run_test.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,26 @@ function build_and_push_images() {
318318
HUB="${KIND_REGISTRY}" TAG="latest" make docker.push
319319
}
320320

321+
function load_prometheus_image_to_kind() {
322+
local NAME="${1:-kmesh-testing}"
323+
local PROMETHEUS_IMAGE="${2:-prom/prometheus:v2.54.1}"
324+
325+
echo "Pulling Prometheus image: $PROMETHEUS_IMAGE"
326+
if ! docker pull "$PROMETHEUS_IMAGE"; then
327+
echo "Failed to pull Prometheus image: $PROMETHEUS_IMAGE"
328+
return 1
329+
fi
330+
331+
echo "Loading Prometheus image to kind cluster: $NAME"
332+
if ! kind load docker-image "$PROMETHEUS_IMAGE" --name "$NAME"; then
333+
echo "Failed to load Prometheus image to kind cluster: $NAME"
334+
return 1
335+
fi
336+
337+
echo "Successfully loaded Prometheus image ($PROMETHEUS_IMAGE) to kind cluster ($NAME)"
338+
return 0
339+
}
340+
321341
function install_dependencies() {
322342
# 1. Install kind.
323343
if ! which kind &>/dev/null; then
@@ -468,6 +488,8 @@ fi
468488

469489
setup_kmesh_log
470490

491+
load_prometheus_image_to_kind
492+
471493
capture_pod_logs &
472494

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

0 commit comments

Comments
 (0)