From e0352db982cbdc6c676fdbf86f1ce35e656661bc Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Thu, 9 Mar 2023 19:10:00 +0800 Subject: [PATCH] [skip e2e]Add script to get ectd status (#22638) Signed-off-by: zhuwenxing --- tests/scripts/get_etcd_info.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/scripts/get_etcd_info.sh b/tests/scripts/get_etcd_info.sh index de73f23b69..7704655133 100644 --- a/tests/scripts/get_etcd_info.sh +++ b/tests/scripts/get_etcd_info.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. instance_name=$1 # Define the etcdctl command with endpoints option etcdctl_cmd="etcdctl endpoint status -w table --endpoints" @@ -6,6 +7,12 @@ etcdctl_cmd="etcdctl endpoint status -w table --endpoints" # Get the ip of all the etcd pods with the specified labels etcd_pods=$(kubectl get pods -l app.kubernetes.io/name=etcd,app.kubernetes.io/instance=${instance_name} -o jsonpath='{.items[*].status.podIP}') +# Check if the etcd pods are running +if [ -z "$etcd_pods" ]; then + echo "No etcd pods found" + exit 1 +fi + # Loop through the list of etcd pods and get their status endpoints="" for pod in $etcd_pods