Skip to content

Commit 3cfa652

Browse files
committed
test
1 parent abcf0d2 commit 3cfa652

5 files changed

Lines changed: 42 additions & 16 deletions

File tree

.github/workflows/plugin-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
on:
24-
pull_request:
24+
push:
2525

2626
jobs:
2727
build:

.github/workflows/windows-plugin-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
on:
24-
pull_request:
24+
push:
2525

2626
jobs:
2727
test-on-windows:

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,28 @@ export SW_AGENT_METER_COLLECT_INTERVAL=1
3434
export SW_AGENT_REPORTER_CHECK_INTERVAL=5
3535
eval "$(grep '^export ' ./bin/startup.sh)"
3636

37+
# HTTP server will listen on 127.0.0.1:8080 (default)
38+
# Container uses network_mode: host, so it should access 127.0.0.1:8080 directly
39+
echo "[DEBUG] Starting HTTP service: ./${project_name}"
3740
./${project_name} &
3841
web_pid=$!
42+
echo "[DEBUG] HTTP service started with PID: $web_pid"
43+
44+
# Wait a moment and check if the service is running
45+
sleep 2
46+
if ps -p $web_pid > /dev/null; then
47+
echo "[DEBUG] HTTP service is running (PID: $web_pid)"
48+
else
49+
echo "[ERROR] HTTP service failed to start or crashed immediately"
50+
fi
51+
52+
# Check if port 8080 is listening
53+
echo "[DEBUG] Checking if port 8080 is listening..."
54+
netstat -an | grep :8080 || echo "[WARN] Port 8080 not found in netstat"
55+
56+
# Try to access the health endpoint from Windows side
57+
echo "[DEBUG] Testing health endpoint from Windows side..."
58+
curl -s http://127.0.0.1:8080/health && echo " - Health check OK" || echo " - Health check FAILED"
3959

4060
echo "[HOST] docker ps -a (before WSL run)"
4161
docker ps -a || true

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,27 @@ healthCheck() {
7373
HTTP_HOST=127.0.0.1
7474
HTTP_PORT={{.Context.Config.ExportPort}}
7575

76-
# Auto-detect a reachable host for Windows service from container context
77-
WINDOWS_HOST=$(grep -m1 nameserver /etc/resolv.conf 2>/dev/null | awk '{print $2}')
78-
POSSIBLE_HOSTS=(host.docker.internal ${WINDOWS_HOST} 127.0.0.1)
76+
# Container uses network_mode: host, so 127.0.0.1 should work directly
77+
echo "[DEBUG] Waiting 10s for Windows service to start..."
78+
sleep 10
7979

80-
for candidate in "${POSSIBLE_HOSTS[@]}"; do
81-
[ -z "$candidate" ] && continue
82-
echo "Probing health endpoint via $candidate:$HTTP_PORT ..."
83-
if curl --max-time 5 -is "http://$candidate:$HTTP_PORT/health" | grep -qE "HTTP/.*\s+200"; then
84-
HTTP_HOST=$candidate
85-
echo "Selected HTTP_HOST=$HTTP_HOST"
86-
break
87-
fi
88-
done
80+
# Debug network connectivity from container side
81+
echo "[DEBUG] Container network debug:"
82+
echo "[DEBUG] - Container hostname: $(hostname)"
83+
echo "[DEBUG] - Container IP addresses:"
84+
ip addr show || ifconfig || echo "No ip/ifconfig available"
85+
echo "[DEBUG] - /etc/hosts content:"
86+
cat /etc/hosts
87+
echo "[DEBUG] - /etc/resolv.conf content:"
88+
cat /etc/resolv.conf
89+
echo "[DEBUG] - Testing localhost resolution:"
90+
nslookup localhost || echo "nslookup failed"
91+
echo "[DEBUG] - Testing 127.0.0.1 connectivity:"
92+
ping -c 1 127.0.0.1 || echo "ping 127.0.0.1 failed"
93+
echo "[DEBUG] - Testing port 8080 on 127.0.0.1:"
94+
nc -zv 127.0.0.1 8080 || telnet 127.0.0.1 8080 || echo "Port 8080 not reachable"
8995

90-
# Sync expected file host to the selected HTTP_HOST to avoid mismatch
96+
# Sync expected file host to match the actual HTTP_HOST
9197
if [ -f /workspace/config/excepted.yml ]; then
9298
sed -i "s#service:8080#${HTTP_HOST}:8080#g" /workspace/config/excepted.yml || true
9399
fi

test/plugins/scenarios/http/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ func main() {
7575
writer.WriteHeader(http.StatusOK)
7676
})
7777

78-
_ = http.ListenAndServe(":8080", nil)
78+
_ = http.ListenAndServe("0.0.0.0:8080", nil)
7979
}

0 commit comments

Comments
 (0)