3232 echo "Installing Apache APISIX via Docker..."
3333
3434 # Clean up any old containers from previous runs
35- docker rm -f apisix etcd 2>/dev/null || true
35+ docker rm -f apisix etcd httpbin 2>/dev/null || true
3636
37+ ######################################################
38+ # 1) Start etcd on host network so 127.0.0.1:2379 works
39+ ######################################################
3740 echo "Starting etcd (gcr.io/etcd-development/etcd:v3.5.10) on host network..."
3841 docker run -d --name etcd \
3942 --network host \
@@ -48,17 +51,29 @@ jobs:
4851 --initial-cluster=s1=http://127.0.0.1:2380 \
4952 --initial-cluster-state=new
5053
51- # Give etcd time to start
5254 echo "Waiting for etcd to start..."
5355 sleep 25
5456
57+ ######################################################
58+ # 2) Start a LOCAL upstream instead of real httpbin.org
59+ ######################################################
60+ echo "Starting local httpbin upstream (mccutchen/go-httpbin) on host network..."
61+ docker run -d --name httpbin \
62+ --network host \
63+ mccutchen/go-httpbin
64+
65+ echo "Waiting for httpbin upstream to start..."
66+ sleep 10
67+
68+ ######################################################
69+ # 3) Start APISIX on host network
70+ ######################################################
5571 echo "Starting APISIX (apache/apisix:3.8.0-debian) on host network..."
5672 docker run -d --name apisix \
5773 --network host \
5874 -e APISIX_STAND_ALONE=false \
5975 apache/apisix:3.8.0-debian
6076
61- # Wait for APISIX
6277 echo "Waiting for APISIX to start..."
6378 sleep 25
6479
88103 docker logs apisix || true
89104 echo "=== etcd logs ==="
90105 docker logs etcd || true
106+ echo "=== httpbin logs ==="
107+ docker logs httpbin || true
91108 echo "status=failed" >> $GITHUB_OUTPUT
92109 exit 1
93110 fi
@@ -120,7 +137,7 @@ jobs:
120137 run : |
121138 START_TIME=$(date +%s)
122139
123- # Create a route that forwards /get to httpbin.org
140+ # Create a route that forwards /get to LOCAL httpbin upstream on 127.0.0.1:8080
124141 RESPONSE=$(curl -s -X PUT \
125142 -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" \
126143 http://127.0.0.1:9180/apisix/admin/routes/1 \
@@ -129,7 +146,7 @@ jobs:
129146 "upstream": {
130147 "type": "roundrobin",
131148 "nodes": {
132- "httpbin.org:80 ": 1
149+ "127.0.0.1:8080 ": 1
133150 }
134151 }
135152 }')
@@ -155,12 +172,17 @@ jobs:
155172 # Give it a moment to sync
156173 sleep 3
157174
158- if curl -s http://127.0.0.1:9080/get | grep -q "httpbin.org"; then
159- echo "✓ route access works"
175+ STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9080/get)
176+
177+ if [ "$STATUS_CODE" = "200" ]; then
178+ echo "✓ route access works (HTTP 200)"
160179 echo "status=passed" >> $GITHUB_OUTPUT
161180 else
162- echo "✗ route access failed"
163- curl -v http://127.0.0.1:9080/get || true
181+ echo "✗ route access failed (status: $STATUS_CODE)"
182+ echo "=== APISIX logs ==="
183+ docker logs apisix || true
184+ echo "=== httpbin logs ==="
185+ docker logs httpbin || true
164186 echo "status=failed" >> $GITHUB_OUTPUT
165187 exit 1
166188 fi
0 commit comments