Skip to content

Commit 1b5839e

Browse files
committed
fix(change HTTP_HOST from service to 127.0.0.1)
1 parent 6d6bbc3 commit 1b5839e

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

test/plugins/runner-helper/templates/validator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ healthCheck() {
4848
exitOnError "{{.Context.ScenarioName}}-{{.Context.CaseName}} url=${HEALTH_CHECK_URL}, status=${STATUS} health check failed!"
4949
}
5050

51-
HTTP_HOST=service
51+
HTTP_HOST=127.0.0.1
5252
HTTP_PORT={{.Context.Config.ExportPort}}
5353

5454
echo "Checking the service health status..."
@@ -59,11 +59,11 @@ echo "Visiting entry service..."
5959
sleep 5
6060

6161
echo "Receiving actual data..."
62-
curl -s --max-time 3 http://oap:12800/receiveData > /workspace/config/actual.yaml
62+
curl -s --max-time 3 http://localhost:12800/receiveData > /workspace/config/actual.yaml
6363
[[ ! -f /workspace/config/actual.yaml ]] && exitOnError "{{.Context.ScenarioName}}-{{.Context.CaseName}}, 'actual.yaml' Not Found!"
6464

6565
echo "Validating actual data..."
66-
response=$(curl -X POST --data-binary "@/workspace/config/excepted.yml" -s -w "\n%{http_code}" http://oap:12800/dataValidate)
66+
response=$(curl -X POST --data-binary "@/workspace/config/excepted.yml" -s -w "\n%{http_code}" http://localhost:12800/dataValidate)
6767
status_code=$(echo "$response" | tail -n1)
6868
response_body=$(echo "$response" | head -n -1)
6969
if [ "$status_code" -ne 200 ]; then

test/plugins/runner-helper/templates/windows-validator.tpl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,43 @@ healthCheck() {
2727
HEALTH_CHECK_URL=$1
2828
STATUS=""
2929
TIMES=${TIMES:-120}
30+
31+
# Debug: Parse URL and check host resolution
32+
echo "[HC-DEBUG] Checking URL: $HEALTH_CHECK_URL"
33+
host_part=${HEALTH_CHECK_URL#*://}
34+
host_part=${host_part%%[:/]*}
35+
echo "[HC-DEBUG] Host part: $host_part"
36+
echo "[HC-DEBUG] Host resolution:"
37+
getent hosts "$host_part" || echo "[HC-DEBUG] Host resolution failed for: $host_part"
38+
3039
i=1
3140
while [[ $i -lt ${TIMES} ]];
3241
do
42+
echo "[HC-DEBUG] Attempt $i/$TIMES: Testing $HEALTH_CHECK_URL"
43+
44+
# Debug: Show curl timing and response details
45+
echo "[HC-DEBUG] Curl timing test:"
46+
curl_timing=$(curl -s -o /dev/null -w "HTTP_CODE:%{http_code} CONNECT:%{time_connect}s STARTTRANSFER:%{time_starttransfer}s TOTAL:%{time_total}s" --max-time 3 "$HEALTH_CHECK_URL" 2>&1 || echo "curl_failed")
47+
echo "[HC-DEBUG] $curl_timing"
48+
49+
# Original health check logic
3350
STATUS=$(curl --max-time 3 -is ${HEALTH_CHECK_URL} | grep -oE "HTTP/.*\s+200")
3451
if [[ -n "$STATUS" ]]; then
35-
echo "${HEALTH_CHECK_URL}: ${STATUS}"
52+
echo "[HC-DEBUG] SUCCESS: ${HEALTH_CHECK_URL}: ${STATUS}"
3653
return 0
3754
fi
55+
56+
echo "[HC-DEBUG] Attempt $i failed, sleeping 3s..."
3857
sleep 3
3958
i=$(($i + 1))
4059
done
4160

42-
echo "Health check failed after $TIMES attempts for ${HEALTH_CHECK_URL}." >&2
43-
echo "Resolver/hosts debug:" >&2
61+
echo "[HC-DEBUG] Health check failed after $TIMES attempts for ${HEALTH_CHECK_URL}." >&2
62+
echo "[HC-DEBUG] Resolver/hosts debug:" >&2
4463
cat /etc/resolv.conf || true >&2
64+
echo "[HC-DEBUG] All hosts entries:" >&2
4565
getent hosts || true >&2
46-
echo "Verbose curl output:" >&2
66+
echo "[HC-DEBUG] Verbose curl output:" >&2
4767
curl -v --max-time 5 -is ${HEALTH_CHECK_URL} || true >&2
4868
exitOnError "{{.Context.ScenarioName}}-{{.Context.CaseName}} url=${HEALTH_CHECK_URL}, status=${STATUS} health check failed!"
4969
}

0 commit comments

Comments
 (0)