@@ -24,7 +24,7 @@ if "${ROOT}/scripts/setup.sh"; then pass "Infrastructure setup finish at $(date
2424# Test infrastructure health (MinIO API + Kubernetes API)
2525log " Testing infrastructure health..."
2626for region in eu us; do
27- CTX=" kind- ${K8S_BASE_NAME} - ${ region}"
27+ CTX=$( get_cluster_context " ${ region}" )
2828
2929 # Test Kubernetes API
3030 kubectl --context " ${CTX} " get nodes && \
@@ -47,7 +47,7 @@ sleep 60
4747# Test monitoring health (Prometheus + Grafana + node/system metrics)
4848log " Testing monitoring stack health..."
4949for region in eu us; do
50- CTX=" kind- ${K8S_BASE_NAME} - ${ region}"
50+ CTX=$( get_cluster_context " ${ region}" )
5151
5252 # Wait for Prometheus pod
5353 kubectl --context " ${CTX} " wait --for=condition=Ready pod -l app.kubernetes.io/name=prometheus \
6262
6363for region in eu us; do
6464 # Test Prometheus HTTP and metrics
65+ CTX=$( get_cluster_context " ${region} " )
6566 PORT=9090; [ " $region " = " us" ] && PORT=9091
66- kubectl port-forward -n prometheus-operator prometheus-prometheus-0 ${PORT} :9090 --context " kind- ${K8S_BASE_NAME} - ${region }" &
67+ kubectl port-forward -n prometheus-operator prometheus-prometheus-0 ${PORT} :9090 --context " ${CTX }" &
6768 sleep 3
6869
6970 [ " $( curl -s http://localhost:${PORT} /-/ready) " = " Prometheus Server is Ready." ] && \
@@ -80,7 +81,7 @@ for region in eu us; do
8081
8182 # Test Grafana HTTP
8283 GPORT=3000; [ " $region " = " us" ] && GPORT=3001
83- kubectl port-forward -n grafana service/grafana-service ${GPORT} :3000 --context " kind- ${K8S_BASE_NAME} - ${region }" &
84+ kubectl port-forward -n grafana service/grafana-service ${GPORT} :3000 --context " ${CTX }" &
8485 sleep 3
8586
8687 GSTATUS=$( curl -s -o /dev/null -w " %{http_code}" http://localhost:${GPORT} /login || echo " 000" )
@@ -96,7 +97,7 @@ if LEGACY=true "${ROOT}/demo/setup.sh"; then pass "PostgreSQL setup finish at $(
9697# Test PostgreSQL health and metrics
9798log " Testing PostgreSQL clusters..."
9899for region in eu us; do
99- CTX=" kind- ${K8S_BASE_NAME} - ${ region}"
100+ CTX=$( get_cluster_context " ${ region}" )
100101 log " Testing region: ${region} "
101102
102103 # PostgreSQL readiness
@@ -115,8 +116,9 @@ sleep 60 # Increased from 45s to ensure both regions have time to scrape
115116cleanup # Clean any lingering port-forwards
116117
117118for region in eu us; do
119+ CTX=$( get_cluster_context " ${region} " )
118120 PORT=9090; [ " $region " = " us" ] && PORT=9091
119- kubectl port-forward -n prometheus-operator prometheus-prometheus-0 ${PORT} :9090 --context " kind- ${K8S_BASE_NAME} - ${region }" &
121+ kubectl port-forward -n prometheus-operator prometheus-prometheus-0 ${PORT} :9090 --context " ${CTX }" &
120122 sleep 3
121123
122124 PGMETRICS=$( curl -s " http://localhost:${PORT} /api/v1/query?query=cnpg_collector_up" | jq -r ' .data.result | length' || echo " 0" )
@@ -132,7 +134,7 @@ log "Waiting 3.5 minutes for recording rules to evaluate (data + buffer)... sta
132134sleep 210 # 3.5 minutes wait for sufficient time series data
133135
134136for region in eu us; do
135- CTX=" kind- ${K8S_BASE_NAME} - ${ region}"
137+ CTX=$( get_cluster_context " ${ region}" )
136138 PORT=9090; [ " $region " = " us" ] && PORT=9091
137139
138140 kubectl port-forward -n prometheus-operator prometheus-prometheus-0 ${PORT} :9090 --context " ${CTX} " &
0 commit comments